Want to set up custom keyboard shortcuts in Ubuntu? xbindkeys let’s you do just that. It’s easy to set up, and should work with any window manager.

Install xbindkeys and its graphical configuration tool using this command:
sudo apt-get install xbindkeys xbindkeys-config

Alternatively, you can click the links below if you are using Ubuntu 7.10 or later:

There’s a bug in xbindkeys that will cause it to crash because there’s no default configuration file. You can work around this problem by running the following command which creates the required file:
touch ~/.xbindkeysrc

Get started creating shortcuts by running xbindkeys-config in a terminal.

xbindkeys-config window

Here’s how to create a new keyboard shortcut:

  1. Click New from the bottom row of buttons.
  2. Type in a name for the shortcut. This is just an identifier and can be anything you like.
  3. Click the Get Key button, wait for the capture window to open, and press the shortcut keys you want to use. Be careful that your shortcut does not conflict with any existing ones in GNOME, Metacity, or Compiz. I’ve found Super(windows)+Letter shortcuts work well as long as you watch out for the few that Compiz uses.
  4. Type the command you want to run with the shortcut in to the Action box. Your command can be anything that runs in the terminal. Here are two examples you may find useful: firefox http://google.com (opens Firefox to a website), gedit myfile.txt (opens a text file). Click the Run Action button to test it out.
  5. Click Apply to enable your new shortcuts.
  6. Before you exit xbindkeys-config, click Save & Apply & Exit to save your settings to the default configuration file and exit.

You need to set up xbindkeys to start when you log in. In GNOME, you can add xbindkeys to the list of startup programs in System->Preferences->Sessions.

The first shortcut I set up was Super-P to open my text file of blog post ideas. What keyboard shortcuts do you find useful?

Related Posts