-
Notifications
You must be signed in to change notification settings - Fork 212
Try to activate app before launching #979
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
Conversation
02fa9b0
to
1e99d80
Compare
1e99d80
to
4a861b3
Compare
Code is looking good and I'll test it tonight on my system. I'm really glad you already added it as an option, otherwise that would have been my next PR 😁. Even though I don't personally want this setting enabled, I think making it the default makes total sense. It does seem to be the dominant mode among other launchers and as a new seeing those that would want it, might not realize it was available if it defaulted to off. For those of us that don't want it, when the behavior changes, that will prompt digging into the settings to see what changed and disabling it. |
I always intended to support the behavior to launch a new window via #476 and maybe adding a manual entry when there's no "new-window" action. And maybe adding a new hotkey (like shift+enter). I think this is a lot better than a setting for it, but we would have to implement #476 first for that, and that's harder. And seeing as there's no reliable way to solve this issue currently, then I prefer a setting so people can opt out if it causes issues for them (as with the Thunar example). |
Unfortunately it seems that
On the upside it kinda works on my emacs session. Except that it picks a random window (presumably the first in the list) to raise, which means it takes me over to another desktop instead of raising the window on the current desktop. But then again maybe this kind of raising setting is just incompatible with a multi-window workflow. |
Oh, that sucks. I did test it in X11 mostly, but also Wayland (actually still using Wayland now because of it) and it worked for the apps I tested. Maybe because I have Gnome set up to remember my session 🤦, and it started the apps with xwayland because I was using X in the previous session. It should "degrade gracefully" when it doesn't work, but making it default when it's not working with pure Wayland feels ugly. Also, this means that I did find this, regarding your previous suggestion to use the Gnome APIs. It seems they removed that option unless you use a shell extension: https://www.reddit.com/r/gnome/comments/pneza1/gdbus_call_for_moving_windows_not_working_in/ Alternative I think this is what wmctrl would need for this to work in Wayland, and it doesn't look like this will be supported any time soon. |
4a861b3
to
fffbf65
Compare
I don't know if we should merge this, but it's the best I could do with this PR for now. I would like to find a better way, but I think there aren't any :( |
be7e681
to
f30cd5c
Compare
f30cd5c
to
fa9241f
Compare
Found a GTK API to use instead of Haven't tested in Wayland yet, but I know it won't work since it's x11 only. |
482e49b
to
8a042d2
Compare
8a042d2
to
74baef3
Compare
This fixes #162 for "pure" X11 (not Wayland or XWayland).
It's added as a non-default setting (because we can't support it in all environments).
It uses the command name or the "WM Class" in the .desktop entry (most apps don't specify the wm class) as the way to identify apps, and it only works on 100% matches (case-insensitive though). I think it's very important to avoid false positives, and better to start this way and deal with any false negatives we discover later (one seemingly safe way could be to strip non-alphanumerics before the comparison).
It's working well in my tests, and since swapping to using Wnck for this we can also add exceptions (like for Thunar that has two different apps identifying the same way and breaks in jumpapp and raise-or-run and even the default Gnome app launcher (but not in this PR).
Checklist
./ul test
is passing (the CI server will check this if you don't)