Can I get Unity-style Super+[1-9] keyboard shortcuts for launching apps in Gnome Shell?
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...