Skip to content

Add support for alt-backtick switching#377

Open
neunenak wants to merge 1 commit into
pop-os:masterfrom
neunenak:alt-backtick
Open

Add support for alt-backtick switching#377
neunenak wants to merge 1 commit into
pop-os:masterfrom
neunenak:alt-backtick

Conversation

@neunenak

Copy link
Copy Markdown

Add support for alt-backtick and alt-shift-backtick to switch between windows of the same application.

@javl

javl commented Feb 11, 2026

Copy link
Copy Markdown

Would someone be able to check if this can be merged? Not having this functionality anymore (compared to before Cosmic) really slows you down when working with multiple windows of the same application. At the moment the only real 'solution' is to put windows next to each other, or go via the previews in the menu bar.

@Alexnder

Copy link
Copy Markdown

@wash2 @jackpot51 @weblate @mmstick can someone please take a look?
The community struggles without the feature.
The original thread pop-os/cosmic-epoch#2125

@leviport

Copy link
Copy Markdown
Member

It's currently a draft. When the author is ready for reviews, it should be marked ready for review.

@neunenak neunenak marked this pull request as ready for review March 18, 2026 19:58
@neunenak

Copy link
Copy Markdown
Author

It's currently a draft. When the author is ready for reviews, it should be marked ready for review.

Ok, I'll mark this as "ready for review". Like I mentioned in pop-os/cosmic-epoch#2125 (comment) , I'm not generally a contributor to cosmic-desktop and I'm not sure if this is mergeable as-is (or what the conventions are for mergeable code in this project). I just want this feature in an official release myself and this code seemed like it worked on my system. I'd be happy if anyone at all who is more familiar with contributing to this project took this code and ran with it, I don't care if my name is on the git commit or not, I just want Alt-backtick to work in cosmic.

@leviport leviport requested review from a team March 18, 2026 20:44
@jacobktm

jacobktm commented Mar 30, 2026

Copy link
Copy Markdown

It looks like this is failing to build on our build server. When I try building it myself on a system I get these errors:

error: mismatched closing delimiter: `)`
    --> src/app.rs:877:39
     |
 877 |                 .flat_map(|(i, item)| {
     |                          -            ^ unclosed delimiter
     |                          |
     |                          closing delimiter possibly meant for this
...
1065 |                 })
     |                  ^ mismatched closing delimiter

error: this file contains an unclosed delimiter
    --> src/app.rs:1234:3
     |
 324 | impl cosmic::Application for CosmicLauncher {
     |                                             - unclosed delimiter
...
 826 |                     LauncherTasks::ShiftAltBacktick => {
     |                                                        - this delimiter might not be properly closed...
...
 843 |                 }
     |                 - ...as it matches this but it has different indentation
...
1234 | }
     |  ^

error: could not compile `cosmic-launcher` (bin "cosmic-launcher") due to 2 previous errors
error: Recipe `build-debug` failed on line 45 with exit code 101

Comment thread src/app.rs

self.alt_backtick = Some(String::new());
self.request(launcher::Request::Search(String::new()));
self.queue.push_back(Message::ShiftAltBacktick);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.queue.push_back(Message::ShiftAltBacktick);
self.queue.push_back(Message::ShiftAltBacktick);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be just this, right?

Comment thread src/app.rs Outdated
IconSource::Name(name) | IconSource::Mime(name) => name,
};
button_content.push(
icon(from_name(name.clone()).into())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
icon(from_name(name.clone()).into())
icon(icon::from_name(name.clone()).into())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

due to imports we need this. Other option is to import from_name from icon

Comment thread src/app.rs Outdated
})))
.into(),
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just missing bracket to close

Comment thread src/app.rs Outdated
return iced_runtime::task::widget(operation::scrollable::snap_to(
SCROLLABLE.clone(),
RelativeOffset {
x: 0.,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
x: 0.,
x: Some(0.),

Comment thread src/app.rs Outdated
SCROLLABLE.clone(),
RelativeOffset {
x: 0.,
y: (self.focused as f32 / (self.launcher_items.len() as f32 - 1.).max(1.))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
y: (self.focused as f32 / (self.launcher_items.len() as f32 - 1.).max(1.))
y: Some((self.focused as f32 / (self.launcher_items.len() as f32 - 1.).max(1.))

@mmm-spot mmm-spot Apr 13, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like Option<f32> is needed here after all

Comment thread src/app.rs Outdated
RelativeOffset {
x: 0.,
y: (self.focused as f32 / (self.launcher_items.len() as f32 - 1.).max(1.))
.max(0.0),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.max(0.0),
.max(0.0)),

Comment thread src/app.rs Outdated
return iced_runtime::task::widget(operation::scrollable::snap_to(
SCROLLABLE.clone(),
RelativeOffset {
x: 0.,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
x: 0.,
x: Some(0.),

Comment thread src/app.rs Outdated
SCROLLABLE.clone(),
RelativeOffset {
x: 0.,
y: (self.focused as f32 / (self.launcher_items.len() as f32 - 1.).max(1.))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
y: (self.focused as f32 / (self.launcher_items.len() as f32 - 1.).max(1.))
y: Some((self.focused as f32 / (self.launcher_items.len() as f32 - 1.).max(1.))

Comment thread src/app.rs Outdated
RelativeOffset {
x: 0.,
y: (self.focused as f32 / (self.launcher_items.len() as f32 - 1.).max(1.))
.max(0.0),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.max(0.0),
.max(0.0)),

@mmm-spot

Copy link
Copy Markdown

Added suggestions to fix the code. Based on my work with Opus 4.5 and running a bunch of tests with cargo build.

Take it or leave it :)

@mmm-spot

Copy link
Copy Markdown

But also awesome work on this initiative. Just chiming in as I really miss this feature too <3

@uriva

This comment was marked as off-topic.

@devashish90

This comment was marked as off-topic.

@posthum4n-ai

This comment was marked as low quality.

@leviport

leviport commented Jun 5, 2026

Copy link
Copy Markdown
Member

I'm not seeing alt+backtick do anything with this change. Is this still a WIP?

@wash2

wash2 commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

I'm not seeing alt+backtick do anything with this change. Is this still a WIP?

After this PR it still requires adding the shortcut in settings that uses the added argument. I guess it could be added as a default shortcut after merging though?

@leviport

leviport commented Jun 5, 2026

Copy link
Copy Markdown
Member

Ah I didn't realize it had to be set up manually. I assume I have to add something to ~/.config/cosmic/com.system76.CosmicSettings.Shortcuts/v1/custom since I'm not seeing it in cosmic-settings?

@wash2

wash2 commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Ah I didn't realize it had to be set up manually. I assume I have to add something to ~/.config/cosmic/com.system76.CosmicSettings.Shortcuts/v1/custom since I'm not seeing it in cosmic-settings?

Ya, I just added a custom shortcut in cosmic-settings.

cosmic-launcher alt-backtick
Alt+grave

@leviport leviport left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, seems to be working nicely after adding the custom shortcut.

Looks like there are some merge conflicts, so I can re-approve once those are fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants