Saturday, August 6, 2011

Shortcut key to switch to any app

I use the command line quite a bit, so I always keep a Konsole window running.  Since I frequently switch to the Konsole window, I thought it'd be much faster if I can bind a global shortcut key.  Like with most things in Linux, the solution is only a Google search away :)

I had to install wmctrl first (sudo apt-get install wmctrl on Ubuntu).  And then I bound the shortcut key Ctrl+Shift+K from my KDE's settings dialog to run the command wmctrl -x -a konsole.Konsole.  -x says that I would be specifying windows using their WM_CLASS values; -a activates the window that follows it.  To get the list of currently open window with their WM_CLASS values, I used the command wmctrl -xl.