1

I have been using Linux on and off for more than a decade. The one thing that keeps me from completely turning my back on Windows is an Autohotkey-Script I wrote years ago that allows me to quickly switch between application windows with the press of the Pause Button (I suffer from thumb-related RSI). It essentially simulates pressing Alt-Tab once.

If I want to switch to an arbitrary window different from the last one I can still use Alt-Tab, but for switching between the two most recent windows I can just press Pause.

In GNOME I can set Pause to perform the task of switching between applications, but there is a significant delay, it does not just switch to the next window, making it impossible to quickly switch between two application windows.

And I can no longer use Alt-Tab to switch to an arbitrary window. Is there a way to replicate the functionality of this Autohotkey-line on Linux, enabling me to switch between application windows without delay and still maintains the original functionality of Alt-Tab?

PAUSE::Send, {ALTDOWN}{TAB}{ALTUP}

Preferably a robust way, provided by a Desktop Environment (KDE, GNOME)?

I have looked into https://github.com/autokey/autokey, but I don't know if it will be around in a couple of years, whereas Autohotkey has been in use for 20 years now and probably will not go away any time soon.

Any suggestions are more than welcome. Thank you very much :).

1
  • Something existing for 20 years is no guarantee it will continue to exist next year, or tomorrow even. Similarly just because something is "new" doesn't mean it won't be here in 20 years. Ultimately if the tool does what you want now, why not use it now? Kick the problem down the road to when it might at some point stop working. That's not to say there isn't a native solution, but why write off something else that might help you? Commented Apr 25, 2023 at 9:35

3 Answers 3

0

In Gnome, you can open "Settings", then scroll to "Keyboard Shortcuts".

There, you can rebind most keyboard shortcuts. The one you are interested in is called "Switch Applications" and is originally bound to Super+Tab.

enter image description here


That said, I rarely use Alt+Tab anymore. As a jump to a browser to look for documentation, or a file manager, I find that my last window is rarely the one I want to target. Instead I use workspaces.

I tend to use one window per workspace. In Gnome I switch between then with Ctrl+Alt+Up or Ctrl+Alt+Down, or you can number them and set keybindings to go to specific workspaces. These keybindings can all be rebound.

With other DEs this can be even easier. I use i3 a lot for this reason. I Mod+Shift+8 to move a window to workspace 8. Then Mod+8 to go there. Switching between workspaces 7 and 8 works fine, then if I need to get distracted by emails or documentation, I can do that on another workspace without contaminating the flow. If you like multiple windows per workspace, Mod+Arrow will take you where you want to go. i3 can also have its keybindings rebound.

1
  • Thanks for the i3-reccommendation. I'll check that out. I already tried the change you outlined in your screenshot. However, when I use that key to switch between applications, there is always this slight delay. The list of all open windows pops up for maybe half a second. Commented Apr 25, 2023 at 11:59
0

In AutoKey, this will work as the contents of a script:

keyboard.fake_keypress("<alt>")
keyboard.fake_keypress("<tab>")

This will also work as the contents of a script:

keyboard.press_key("<alt>")
keyboard.press_key("<tab>")
keyboard.release_key("<tab>")
keyboard.release_key("<alt>")

Note that you might have to pay attention to the hotkey after setting it. In some of my experiments, the Ctrl and Alt keys were automatically selected for me. If you look at your hotkey after setting it and saving the script and it shows as Ctrl+Alt+pause, you can edit the hotkey by pressing the Set button to the right of it again and clicking the Ctrl and Alt buttons to deselect them and then clicking the OK button to set the hotkey and following that up by clicking the Save button in the AutoKey toolbar.

0

KDE also allows rebinding the "Walk through windows" keyboard shortcut to a single button:

a screenshot of KDE System Settings showing the keyboard shortcut editor for "Walk Through Windows"

When I tested it, I didn't notice the the list of windows pop up like it does when holding alt during alt+tab

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.