Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support --reverse for alt-tab #183

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bbb651
Copy link

@bbb651 bbb651 commented Sep 2, 2024

Also fixes behavior of alt[-shift]-tab not triggering the first time when the launcher activates.
This seems to have been done intentionally, but this does not match any existing implementation of window/tab switching I know (e.g. Gnome, KDE, Windows, MacOS, Firefox, Chromium, VSCode, Zed, etc.) and IMO is very bad UX because triggering it once quickly will do nothing windows are sorted by last window focus.

@git-f0x I worked on it some more and I think this is all that needs to be done on the cosmic-launcher side, but I haven't tried adding the alt-shift-tab shortcut yet.

Also, I ended up getting into a bit of a rabbit hole with debugging, to properly test the activation it has to run in cosmic-session, so I ended up symlinking it in-place of my system's cosmic-launcher, but then I had to resort to trying to write to a named pipe (which failed but I couldn't figure out why), and displaying it through the UI. Does cosmic-session provide a way to view logs for components for the current session, or is there any better way to test?

Also fixes behavior of `alt[-shift]-tab` not triggering
the first time when the launcher activates.
This seems to have been done intentionally, but this does
not match any existing implementation of window/tab switching I know
(e.g. Gnome, KDE, Windows, MacOS, Firefox, Chromium, VSCode, Zed, etc.)
and IMO is very bad UX because triggering it once quickly will
do nothing windows are sorted by last window focus.
@bbb651
Copy link
Author

bbb651 commented Sep 3, 2024

The cosmic-settings part is still missing, I'm not sure how to get it to actually use my local version of cosmic-settings-daemon, [patch.'https://github.com/pop-os/cosmic-settings-daemon'] seems to only work for transitive dependencies, cosmic-settings-config = { path = "../../cosmic-settings-daemon" } can't find the crate and cosmic-settings-config = { path = "../../cosmic-settings-daemon", package = "cosmic-settings-daemon" } renames it to the wrong thing (actually package = cosmic-settings-config might work, I haven't tired it yet).

When installing it onto my system (the rest of the packages are the alpha1 version, not git) neither alt + tab nor alt + shift + tab function, I'm not sure why and it's very difficult to debug...

@skylerberg
Copy link

I got it using my local version by specifying the exact directory to use by tacking config on the end:
cosmic-settings-config = { path = "../../cosmic-settings-daemon/config" }

That should make it easier to debug, so I'll see if I can figure out what the issue is.

@skylerberg
Copy link

I have not yet figured out what part of this PR isn't working, but I have figured out why the code intentionally did not cycle the first time. The list is not relative to the application you are using. To explain what I mean, suppose you have three applications open, and we will call them Application 1, Application 2, etc.

The list will always display Application 1, Application 2, and Application 3. So if you currently are focused on Application 1 and you quickly strike Alt-Tab and release, nothing will happen. If you are Application 2 and you strike Alt-Tab and release, you will switch to Application 1. Application 1 is always first.

So this change just makes Alt-Tab always select Application 2 first.

What we should really have is a list sorted by most recently focused and have Alt-Tab cycle to the next most recently focused on first press. That also lets you toggle between two tabs.

@skylerberg
Copy link

I created the pull request needed for cosmic-settings: pop-os/cosmic-settings#675

Using my cosmic-settings, and your cosmic-settings-daemon, cosmic-comp, and cosmic-launcher is working as expected!

if self.alt_tab {
self.focus_next();
Message::AltTab { reverse } => {
self.alt_tab = true;

Choose a reason for hiding this comment

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

Based on my comment in the conversations section, I think we should switch this back to not cycle when opened for now.
Once we have the applications ordered by most recently focused, we should make the change to cycle on the first use of Alt-Tab.

@wiiznokes
Copy link

This sould be covered by #150 iirc

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.

3 participants