Opening a window # in the GNOME window list using a keyboard shortcut

Grant Heaslip me at grantheaslip.com
Thu Sep 2 01:23:43 UTC 2010


On Wed, 1 Sep 2010, Grant Heaslip wrote:

> I'm looking for a way to assign the windows in the GNOME/Metacity window
> list to keyboard shortcuts, similarly to the way that you can assign
> workspaces to keyboard shortcuts.

I (somewhat) solved this on my own.

It doesn't look like there's any way to actually refer to windows as
numbers (I'm not familiar with the implementation details of GNOME or
Metacity, but it doesn't seem to be the kind of use case they had in
mind). That said, I figured out a workaround for what I wanted to achieve,
which is assigning specific windows to keyboard shortcuts.

- Install wmctrl (sudo apt-get install wmctrl), which is a command-line
   tool for controlling window managers
- Install compizconfig-settings-manager (sudo apt-get install
   compizconfig-settings-manager), which is a GUI for configuring Compiz
- Open System -> Preferences -> CompizConfig Settings Manager, and open
   the commands panel
- For each window you'll want to activate from the keyboard, enter a
   command like "wmctrl -a Firefox" (open the first window it finds with
   "Firefox" in the title, matched anywhere in the string)
- Each window will need a unique title if you want to reliably open it.
   You can change the title of Terminal windows by making a profile and
   changing the title in Edit -> Profile Preferences. I'm not sure how to
   handle other applications (I only needed a couple of terminal windows
   and Firefox).
- Head to the "Key bindings" tab and set keyboard shortcuts for the
   corresponding commands, and you're set

I guess the moral here is that you shouldn't get too attached to one
possible solution to a problem when instead of banging your head into the
wall trying to make it work, you could go at the problem from a different
perspective. Being a programmer, I should probably follow that advice more
often :).




More information about the ubuntu-users mailing list