keyboard shortcut to jump to favorited-in-dock application's windows
most window managers (e.g. kde, even windows xp and newer) allows switching applications that are pined to their respective quick launch/dock areas by pressing win
+1
for the first icon, win
+2
for the second, etc.
ubuntu's gnome (i'm using 20.04 default WM, should i call it gnome or unity? not sure anymore) allows me to do that, but other window managers also allow me to work with more than one window from each app, by simply pressing the shortcut repeatedly. (note that it goes in order of window age, not last used time, like alt+tab --but at this point i'm fine with either)
For example, on KDE or Windows 10, assuming several terminal windows, and terminal is my third application on the "Dock", pressing win
+3
once, will take me always to the first opened terminal window. pressing win
+(3
x2) will take me always to the second opened terminal window and so on.
Is there any way (maybe an extension) to enable this essential* functionality on ubuntu 20.04?
* jumping to specific windows predictably is essential for vision and/or motion impaired users.
PS: pressing the shortcut twice on gnome opens a popup to select the individual application windows by showing unreadable thumbnails, only via the arrow keys. If a solution to the above problem completely disables this feature, it is OK.
PS2: most questions i found around this problem end up having several answers suggesting tabs on the terminal. I made the mistake of also using the terminal as an example 😅, but I am looking for a solution that is not dependent of application. Please do not answer with terminal tabs suggestions.
Indeed, the behavior of the Super+Number keys is to mimic a click on the Dash or Dock, i.e., it brings all windows of the application to the foreground, and if no windows are open, it launches the app.
There are ways to define shortcut keys in a different way, where they only bring one window in the foreground, and where repeatedly pressing the key cycles through the open window.
X-org users (default in Ubuntu 20.04)
The shell script jumpapp allows to set up shortcut keys with the behavior you describe. Pressing the shortcut key will switch to the application if it is running, otherwise launch it. Repeatedly hitting the shortcut key will cycle through all open windows. That script relies on wmctrl
, and therefore unfortunately does not work on Wayland, a newer display driver that is used by default in Ubuntu 20.10 and up.
The script can be installed according to instructions on the jumpapp website over at github.
Default Super+Number keybindings can be disabled by commands, e.g. for Super+1
gsettings set org.gnome.shell.keybindings switch-to-application-1 ['']
That key then becomes available to bind a custom command, using "Settings" - "Keyboard shortcuts", section "Custom Shortcuts". Such command can be for example:
jumpapp gnome-terminal
which would either launch the terminal or launch between open terminal windows.
This approach is disconnected from the dock. If you change the order of icons on the dock, you need to reassign the shortcut keys. However, this approach also allows you to set up any keybinding, e.g. Super+T for the terminal or Super+w for the webbrowser.
Wayland (default in Ubuntu 20.10 and up)
Wayland users can use a Gnome Shell extension, Run or raise by e2rd. Also this extension will allow to cycle through the open windows by repeatedly pressing the key. The extension's home page contains detailled instructions on how to setup keybindings.
This extension can be installed from the Gnome Shell extensions website.