Blog
arrow
2012-05-29 22:53
Activate some window using hotkey in Ubuntu

Let's assume we need to activate Firefox window when user presses Alt+1, activate Gedit on Alt+2 etc. Any program and any hotkey can be used.

CUT

Install package wmctrl, if it isn't already installed:

sudo apt-get install wmctrl

Press icon in right bottom corner, choose 'System settings → Keyboard - Shortcuts'. Press '+' button, input name: 'Switch to Firefox', command:

wmctrl -a firefox

After save, click second column and press decided hotkey. Repeat these actions as many times as you need.

If the program specified is not currently running, nothing will happen on hotkey press. If the program is open, its window will be activated.

The string ('firefox') specified in the command must be contained by window title. For example, to activate Google Chrome or Chromium (depends on which is running), you should set command wmctrl -a chrom.


Up