Can I get Unity-style Super+[1-9] keyboard shortcuts for launching apps in Gnome Shell?

I'm trying out Gnome Shell instead of Unity to see if I like it better, and the Unity feature that I miss most is the ability to switch to specific applications using Super+ any number from 1 to 9. Is there any way to add this feature to Gnome Shell?

I could add custom shortcuts using the Gnome Shell System Settings, but those shortcuts would always launch new windows instead of switching to existing ones.


Option 1: Gnome Shell extension: AppKeys

This extension emulates the Unity behavior in Gnome Shell: https://extensions.gnome.org/extension/413/dash-hotkeys/

Does exactly what is expected and adds some more key bindings, like opening a new window for the application with Super+Shift+[1-9]. Confirmed working in Ubuntu 14.04.2 and Gnome Shell 3.10.4.

Option 2: xbindkeys & wmctrl

While It's not as user-friendly to setup and manage, you can get this kind of functionality in many environments, by using wmctrl and xbindkeys.

Xbindkeys can set to start at login. It will monitor a file called .xbindkeysrc, which can contain lines like this:

#Launch or switch to E-mail
"wmctrl -xa Thunderbird || thunderbird"
    Alt + 2

#Launch or switch to Konsole
"wmctrl -xa Konsole || konsole"
    Alt + 3

#Launch or switch to IRC client
"wmctrl -xa Xchat || xchat"
    Alt + 4

Like Unity, with this recipe you set up a key to switch to an application if it is running, or launch it if is not. I used Alt here, but you could use Mod4 instead, I think.

Option 3: Use workspace-switching shortcuts

Something similar is to assign keyboard shortcuts that switch to specific desktops (or "Workspace"). If you run one application per workspace, then the shortcut effectively switches to that application. Look under Keyboard: Shortcuts: Navigation for the place to set the workspace-switching shortcuts.

Option 4: gnome-shell-extensions-windows-navigator

After installing this Gnome extension, in overlay mode you can hold the ALT key and see a number assigned to each window. You can then press the number to switch the window. More here, including installation instructions.


Based on Mark Stosberg's "Option 1", using wmctrl, I've implemented a small script do this, launching apps using .desktop files. By launching .desktop files it also acts as a replacement for xdg-open, which is buggy in Oneiric (it opens .desktop files in a text editor instead of launching the appropriate application).

~/bin/desktop-open:

#!/bin/bash
NAME=`grep '^Name=' $1 | sed 's/^Name=//' | sed 's/%.//'`
EXEC=`grep '^Exec=' $1 | sed 's/^Exec=//' | sed 's/%.//'`
wmctrl -xa $NAME || $EXEC &

I've then used the GNOME keyboard settings to set-up custom keyboard short-cuts, where a short-cut's command is e.g. /home/richardt/bin/desktop-open /usr/share/applications/gvim.desktop.

What I haven't managed to do is use a short-cut that comprises the Super key - GNOME seems to want to reserve this for switching to the Activities Overview, but perhaps that's a bug...


DockbarX includes the following option in its Preferences pane:

Use Unity style number shortcuts (Super+number).

It is pretty much the sole reason I am using it currently in Linux Mint 14 ("The DockbarX applet for MATE panel" as listed by dpkg-query). In Linux Mint, I had to add the standalone "DockX" to Startup Applications.

I have no experience with Unity so I was looking for a similar behaviour as the Windows 7 taskbar. One thing that Unity/Dockbar is missing compared to Windows 7 is that it won't minimize the window when it is already focused. It will only launch the app, or switch the focus to it. I found the minimize behaviour also very handy to quickly remove clutter and focus better on my current task. It looks like I might be able to emulate that by adapting the example scripts shared in the other answers here.