Thursday, December 2, 2010

Window positioning with keyboard short-cuts

In Windows 7, when you press Windows key + arrow key, it resizes current window to maximized, minimized, or left half/right half which I find very useful for wide-screen monitors or laptops.

After switching from dual "square" monitors to a single wide-screen at work, I was looking for similar functionality with Ubuntu/Gnome.  Here's how to approximate the functionality:

  1. System > Preferences > CompizConfig Settings Manager (install "compizconfig-setting-manager" package if menu item not available)
  2. Under General Options > Key bindings tab, you can, for instance, set keyboard short-cuts for Maximize Window and Unmaximize Window.  I've mapped these to + up arrow key and + down arrow key, respectively
  3. Enable the Put plugin (in the Window Management section) 
  4. In the Bindings tab, in the Put within viewport section, I've mapped the various positions to + number on numeric keypad (e.g. Put Top is + 8)
FYI, usually is already mapped to your Windows key (for that style keyboard).


Some annoying gotchas:
  • You can't reposition a window if it is Maximized (makes sense, but behaves differently than Windows 7)
  • Certain applications (Thunderbird, Firefox, e.g.) refuse to be repositioned; they'll just jump back to their original position
  • Put Center doesn't appear to work properly, even for windows that don't otherwise have problems being re-positioned
In comparison to the Windows 7 feature, the Put plug-in is not quite as good because it only repositions, but does not also resize the window to appropriate dimensions.