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've got a single massive monitor at home, and I've decided to mimic the Windows 7 window tiling shortcuts. I found a few guides online using wmctrl, and it's going well, save one thing: maximized windows don't respond to it.

--type string 
--set /apps/metacity/keybinding_commands/command_1 
   -r :ACTIVE: 
   -e 0,
      `xwininfo -root | grep Width | awk '{ print ($2/2)}'`,
      `xwininfo -root | grep Height | awk '{ print $2 }'`"

(I've added line returns to make an otherwise massive one-liner readable.) I've bound this to a hotkey and it works, unless the window is maximized. Any ideas on how to fix this up?

share|improve this question
up vote 1 down vote accepted

It works, if you first unmaximize it:

wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz && wmctrl -r :ACTIVE: -e 0,0,0,$(xwininfo -root | grep Width | awk '{print ($2/2)}'),$(xwininfo -root | grep Height | awk '{print $2}')
share|improve this answer
Thanks! I'll try this tonight when I get home and mark resolved when it works. – jldugger Feb 2 '11 at 16:36
So I tried that and it doesn't work. I'm using metacity as a window manager, could that be the problem? – jldugger Feb 3 '11 at 2:38
It's possible that you need the keybinding to be just one command, so try using bash with the -c option: /bin/bash -c "COMMAND" – htorque Feb 3 '11 at 8:57
Yeah, just tested it - it doesn't work as keybinding if you use the double ampersand, but works if you feed it as command string to bash. – htorque Feb 3 '11 at 8:59
Thanks, that seems to have been the problem. Sorry I didn't get back on this sooner, I didn't notice the comments. – jldugger May 9 '11 at 1:09

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.