Skip to content

Ubuntu “Snap” Effect

by drphrozen on July 15th, 2010

I wanted a snap effect like the one in Windows 7, although not the drag and snap kind, but the Windows Key + Left|Top|Right|Down kind. I followed this guide on OMG! Ubuntu, but it wasn’t exactly what i wanted.

Here is my recipe:

Install the required components:

sudo apt-get install compizconfig-settings-manager wmctrl

Open the Compiz Config Settings Manager (ALT+F2 ccsm or System > Preferences > CompizConfigā€¦, etc).

Insert the following commands (Commands > CommandsĀ > Command line 0-3):

WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -b remove,maximized_horz && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -b remove,maximized_horz && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1
wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz

Now map the keys (Commands > Key Bindings > Run command 0-3):

  • <Super>Left
  • <Super>Right
  • <Super>Up
  • <Super>Down

Example:

From → Uncategorized

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS