How to enable Windows Key + number in gnome to switch to a window in the taskbar or panel

GNOME 3 does not have this functionality built-in, as you have discovered.

As a workaround, create a keyboard shortcut for a RaiseOrRun.sh script

  1. Create /home/<username>/RaiseOrRun.sh script
  2. Run chmod +x /home/<username>/RaiseOrRun.sh to make it executable.
  3. Open GNOME Settings, Keyboard
  4. For each application "Added to Favorites":
    1. Scroll to the bottom and press the + button to add a Custom Shortcut
      • Name: Choose any name
      • Command: /home/<username>/RaiseOrRun.sh <WM_CLASS> <EXECUTABLE>
      • Example: /home/<username>/RaiseOrRun.sh chromium chromium-browser
    2. Click the Edit button and press the Shortcut Key you want (ie: Super+1)
    3. Click Add to confirm

Notes:

  1. This solution knows nothing of the GNOME 3 Dash. If you want to maintain the Super+1 for first app in Favorites, you will have to keep the shortcut key and Dash position in sync manually.

  2. Display the WM_CLASS for each open application with wmctrl -l -x

  3. See also: Alt+Tab sucks; here's a solution - Exploits of a Programmer - Vicky Chijwani (explains why "run-or-raise" is better than workspaces).


Script: RaiseOrRun.sh

#!/bin/bash

# $1 - case insensitive word in WM_CLASS
# $2 - command to start application

# wmctrl 
# -a <WIN> Activate the window <WIN> by switching to its desktop and raising it.
# -x Include WM_CLASS in the window list or interpret <WIN> as the WM_CLASS name

wmctrl -x -a "$1" || "$2"

Tags:

Ubuntu

Gnome