Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to have two shortcuts each for "Put Left" and "Put Right" for positioning windows in the left and right position.

Specifically, I would like the default keys as well as some custom keys that are more accessible when typing:


  • Put Left: <Control><Alt>KP4 and <Shift><Alt>H
  • Put Right: <Control><Alt>KP6 and <Shift><Alt>L

The CompizConfig dialogue box appears to only allow one shortcut key to be assigned.

How can I have two shortcut keys enabled for a single grid compiz-config setting?

share|improve this question
Is there any option in ccsm to type in the command rather than the GUI option? – Bill O'Dwyer Aug 1 '12 at 16:59
I just found out that this will not work if you log in with Ubuntu 2D. Greetings! – user189458 Sep 2 '13 at 13:43
up vote 8 down vote accepted

One way to do it is simply map the custom secondary keyboard shortcut to the primary (Compiz) shortcut using xdotool.

  1. xdotool is a small command-line utility which allows automation of keyboard and mouse clicks/movements; install it with sudo apt-get install xdotool
  2. We'll assume here that the default shortcuts for Grid Left/Right are as below: (Ctrl+Super+Left/Right):

    enter image description here

  3. Open Settings...Keyboard, and go to the Shortcuts tab. Click + to create a custom shortcut, naming it say Compiz GridRightAlt, and setting the "Command" field to:

    xdotool key --clearmodifiers Ctrl+Super+Right

    Click Apply. The right-column will say Disabled, click on it and you'll see "New Accelerator": press your shortcut key combo, e.g. Shift+Alt+L.

    enter image description here

    • Repeat the steps for the left Compiz GridLeftAlt, setting the command to:
    xdotool key --clearmodifiers Ctrl+Super+Left

    and the shortcut keycombo to Shift+Alt+H.

Close the Keyboard settings and that's it!

share|improve this answer

As far as I can tell compiz will only allow one keybind as you noticed.

However with a tiny bit of work you can get around this limitation!

First install pycompiz found here. If you have svn you can do this using

svn checkout pycompiz-read-only

Install after navigating into the projects folder,

sudo python install

Next create these two tiny python scripts, and place them in your ~/bin folder. Then either make them executable (chmod u+x FILENAME) or when setting the keybindings use python SCRIPTNAME.

file: putleft

import compiz'grid', 'put_left')

file: putright

import compiz'grid', 'put_right')

Lastly you can create two custom command shortcuts for each of these scripts in the custom commands section of the compiz config (ccsm), and hey presto - two keybinds to achieve the same effect. As mentioned above, if you made the scripts executable, the commands will be putleft and putright, else they will be python ~/bin/putleft and python ~/bin/putright.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.