|(Click the photo for better resolution in Picasa Photostream)|
Pretty easy, right? However, if you use desktop effects you won't be able to add a shortcut that runs a script the same way, since metacity is not your window manager. Compiz is.
The alternative option would be to fire up gconf-editor and add the command directly under apps > metacity > keybinding_commands and apps > metacity > global_keybindings. However, it doesnt't work either. Why? Again, because metacity is not your window manager if you use desktop effects.
So, how to do it? First you have to install the Compiz Config Settings Manager. Launch a terminal ( default keyboard shortcut for launching the terminal is Ctrl+Alt+T ) and run
sudo apt-get install compizconfig-settings-manager
After installing, run
Then you just have to click the "Commands" icon in the General section, define the command in the "Commands" tab and the shortcut to launch it in the "Shortcut Keys" tab and that's it.
As an example, if you wanted to create shortcut keys to control your computer's volume just like the multimedia keys you could use
xdotool key XF86AudioLowerVolume
to lower the volume and
xdotool key XF86AudioRaiseVolume
to raise your volume. Note that if you don't have xdotool installed on your computer you need to install it first
sudo apt-get install xdotool
Xdotool is a tool that let's you simulate keyboard input and mouse activity, move and resize windows, etc. It was developed as a command line X11 automation-tool. For more information check the xdotool project on semicomplete.
Did you find this post helpful? Do you wish to contribute to other projects regarding computer science, electronics, robotics or mechatronics that will be posted in this blog? If you wish to do so, you can donate via paypal using the button below. Thanks! :)