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

[FEATURE REQUEST] custom keybinding #239

Closed
JE-Amouel opened this issue Jun 30, 2024 · 29 comments
Closed

[FEATURE REQUEST] custom keybinding #239

JE-Amouel opened this issue Jun 30, 2024 · 29 comments

Comments

@JE-Amouel
Copy link

Hi,
would it be possible to be able to set another hotkey to trigger the switcher?
thanks your precious support.

@dsheeler
Copy link
Owner

Do you mean you'd like to use some other key combination? If so, that's a gnome settings thing:

#190 (comment)

@JE-Amouel
Copy link
Author

yes, but just a little more than that, as I explained in issue #237, I use two extensions which both serve as alt+tab to switch windows or applications, both have interfaces which offers totally different functionality, I want to be able to keep them and use them according to the circumstances, the problem is that if I change the keyboard shortcuts from the gnome settings, it will always be the same problem since both extensions point to the same keyboard shortcuts ,

but instead of being able to define a different keyboard shortcut in the coverflow settings, do you think it would be possible to have a mechanism that triggers the coverflow switch from d-bus ?
like that I could use a script which will allow me to target coverflow only.

what do you think about?

@dsheeler
Copy link
Owner

dsheeler commented Jul 1, 2024

I have a solution for your situation without changing code, I think. Assuming you just want to cycle all windows (and not windows grouped by application), you can then go to settings gui and under "Application Switcher" turn on "Make the Application Switcher Behave Like the Window Switcher", and then go to "Keybindings" and make sure to turn off 'Bind to 'switch-windows'' and turn on 'Bind to 'switch-applications''. Then go to your system settings keyboard shortcuts and set something other than Alt+Tab to "Switch applications"; I set it to Super+Tab. With all this in place, Alt-Tab should be used by the other extension, and Super-Tab (or whatever key combination you choose) will be used by this extension. Let me know if that works for you

@dsheeler
Copy link
Owner

dsheeler commented Jul 1, 2024

I could also add another shortcut altogether; I totally forgot I just did this for the Gravatar extension! Hard to believe the things I forget.

@JE-Amouel
Copy link
Author

very nice idea,

I have a solution for your situation without changing code, I think. Assuming you just want to cycle all windows (and not windows grouped by application), you can then go to settings gui and under "Application Switcher" turn on "Make the Application Switcher Behave Like the Window Switcher", and then go to "Keybindings" and make sure to turn off 'Bind to 'switch-windows'' and turn on 'Bind to 'switch-applications''. Then go to your system settings keyboard shortcuts and set something other than Alt+Tab to "Switch applications"; I set it to Super+Tab. With all this in place, Alt-Tab should be used by the other extension, and Super-Tab (or whatever key combination you choose) will be used by this extension. Let me know if that works for you

but the problem is that, that other extension internally wraps the two switchers, the application switcher and the window switcher,
which means that there will always be a conflict.

I still tried your suggestion, and there is still the same conflict.

@p91paul
Copy link
Collaborator

p91paul commented Jul 2, 2024

If 2 extensions bind the same event, the one coming later wins. Which means it's quite unpredictable, as I do not think there are ordering guarantees for gs extensions loading. It might be still be deterministic (e.g. for a specific system it always either works or doesn't). I do not think conflicting extensions can be resolved, except by the user by disabling one of them.

@G-dH
Copy link

G-dH commented Jul 3, 2024

Just a note: AATWS only extends the default switchers by injecting relevant classes, no switcher keybindings are affected.

@dsheeler
Copy link
Owner

dsheeler commented Jul 7, 2024

@G-dH could you point to where that happens in your code?

@dsheeler
Copy link
Owner

dsheeler commented Jul 8, 2024

@JE-Amouel, I have a branch that I'll push to github once I commit what I'm working on. I have the extension adding custom actions and a preferences gui way to set shortcut keys. I need to test more, but it might be correct.

The demo shows both aatws and coverflow working.

customActionDemo.mp4

@dsheeler
Copy link
Owner

dsheeler commented Jul 8, 2024

@JE-Amouel
Copy link
Author

Hi,
I have already downloaded the zip file, but I can't install it without an error showing up, can you show me how I should proceed?

@dsheeler
Copy link
Owner

@JE-Amouel, you unzip, cd into the new directory, and type make in the terminal. That will install it. Then you have to restart the shell...

@dsheeler
Copy link
Owner

@JE-Amouel, its my bad. I left a file out of the commit.

@G-dH
Copy link

G-dH commented Jul 14, 2024

@G-dH could you point to where that happens in your code?

@dsheeler Sorry, I forgot to answer. AATWS overrides AltTab.WindowSwitcherPopup and AltTab.AppSwitcherPopup classes, while CoverflowAltTab redirects the default keyboard shortcuts elsewhere. Therefore, I do not expect any conflicts, and my tests support this assumption.

@dsheeler
Copy link
Owner

yes, but just a little more than that, as I explained in issue #237, I use two extensions which both serve as alt+tab to switch windows or applications, both have interfaces which offers totally different functionality, I want to be able to keep them and use them according to the circumstances, the problem is that if I change the keyboard shortcuts from the gnome settings, it will always be the same problem since both extensions point to the same keyboard shortcuts ,

but instead of being able to define a different keyboard shortcut in the coverflow settings, do you think it would be possible to have a mechanism that triggers the coverflow switch from d-bus ? like that I could use a script which will allow me to target coverflow only.

what do you think about?

@JE-Amouel, I have implemented a simple version of your dbus activation. https://github.com/dsheeler/CoverflowAltTab/tree/dBus

https://github.com/dsheeler/CoverflowAltTab/blob/dBus/testdbus.js is a gjs script that executes the launch method.

@dsheeler
Copy link
Owner

initiate_with_dbus-2024-07-15_00.02.38.mp4

I use custom hot corners to call the script.

@JE-Amouel
Copy link
Author

that's great 😍

@JE-Amouel
Copy link
Author

@JE-Amouel, you unzip, cd into the new directory, and type make in the terminal. That will install it. Then you have to restart the shell...

@dsheeler i got this error when i execute make
(gnome-extensions pack:10179): GLib-GIO-CRITICAL **: 19:04:43.731: g_subprocess_wait: assertion 'G_IS_SUBPROCESS (subprocess)' failed Failed to execute child process “msgfmt” (No such file or directory) make: *** [Makefile:45: build] Error 2

@dsheeler
Copy link
Owner

I think you need a gettext package because you're missing a command (msgfmt) associated with that.

@JE-Amouel
Copy link
Author

I think you need a gettext package because you're missing a command (msgfmt) associated with that.

that work fine now , have been able to install it, i do really like the new features 👍 💯

how to use the dbus features?

@dsheeler
Copy link
Owner

dsheeler commented Jul 20, 2024

@JE-Amouel, I just uploaded a new version on https://github.com/dsheeler/CoverflowAltTab/tree/dBus. Install the latest.

There are four methods in the dbus interface:

  1. The launch method which takes a string that should be either winows or applications
gdbus call --session --dest org.gnome.Shell.Extensions.Coverflowalttab --object-path /org/gnome/Shell/Extensions/Coverflowalttab --method org.gnome.Shell.Extensions.Coverflowalttab.launch "windows"
  1. The next method which takes no arguments.
  2. The previous method which also takes no arguments.
  3. The select method breaks out of the switcher.

I'm not sure 2., 3., or 4. are that useful, but who knows?

@JE-Amouel
Copy link
Author

i just tested, and ... , I'm about to let go of a tear, it's so wonderful 💯 💯 👍

@JE-Amouel
Copy link
Author

JE-Amouel commented Jul 20, 2024

I'm not sure 2., 3., or 4. are that useful, but who knows?

🤣 for sure, who know !? prepare peace before problems.

@dsheeler
Copy link
Owner

Well, that was educational for me. I never really messed around with dbus before.

@JE-Amouel
Copy link
Author

really?, given the speed at which you did this, I'm even thinking of asking you for some advice.

@dsheeler
Copy link
Owner

dsheeler commented Jul 20, 2024

I probably won't know! I am surprised what I did works :)

@JE-Amouel
Copy link
Author

I probably won't know! I am surprised what I did works :)

in fact I think that talent is the bug of the impossible, we have just found the main bug of the impossible. 😄

@JE-Amouel
Copy link
Author

Really, thank you for this great work, if I ever find a bug or have a feature that i found important , I sincerely hope that you will also be willing to talk about it.
Thanks 🙏

@dsheeler
Copy link
Owner

Of course!!! Thank you for the ideas!

@dsheeler dsheeler closed this as completed Sep 8, 2024
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

No branches or pull requests

4 participants