dsheeler / CoverflowAltTab

Coverflow like Alt-Tab replacement for Gnome-Shell
GNU General Public License v3.0
362 stars 90 forks source link

[FEATURE REQUEST] custom keybinding #239

Closed JE-Amouel closed 2 months ago

JE-Amouel commented 4 months ago

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

dsheeler commented 4 months ago

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

https://github.com/dsheeler/CoverflowAltTab/issues/190#issuecomment-1406690067

JE-Amouel commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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

dsheeler commented 4 months ago

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

dsheeler commented 4 months ago

@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.

https://github.com/dsheeler/CoverflowAltTab/assets/1632985/f3c34fe1-8734-4291-a274-c099a709700c

dsheeler commented 4 months ago

https://github.com/dsheeler/CoverflowAltTab/tree/custom-shortcuts

JE-Amouel commented 4 months ago

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 commented 4 months ago

@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 commented 4 months ago

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

G-dH commented 4 months ago

@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 commented 4 months ago

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 commented 4 months ago

https://github.com/user-attachments/assets/c2a6e6c0-2be0-471b-8c8d-8bc33b310112

I use custom hot corners to call the script.

JE-Amouel commented 4 months ago

that's great :heart_eyes:

JE-Amouel commented 4 months ago

@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 commented 4 months ago

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

JE-Amouel commented 4 months ago

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 :+1: :100:

how to use the dbus features?

dsheeler commented 4 months ago

@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 commented 4 months ago

i just tested, and ... , I'm about to let go of a tear, it's so wonderful :100: :100: :+1:

JE-Amouel commented 4 months ago

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

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

dsheeler commented 4 months ago

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

JE-Amouel commented 4 months ago

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

dsheeler commented 4 months ago

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

JE-Amouel commented 4 months ago

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. :smile:

JE-Amouel commented 4 months ago

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 :pray:

dsheeler commented 4 months ago

Of course!!! Thank you for the ideas!