AeroSnap in Ubuntu: My Take

→ January 19th, 2010

Based off of an OMG! Ubuntu! post, which was in turn based off of an Ubuntu forum post, here’s my take on Aero Snap type functionality in Ubuntu.

First, we need the utilities to edit Compiz settings and control the windows:

sudo apt-get install compizconfig-settings-manager wmctrl

Next, launch the Compiz Config Settings Manager, which can be found in System → Preferences. Go to the Commands section. For Command Line 0, use:

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: -e 0,0,0,$HALF,-1

For Command Line 1, use:

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: -e 0,$HALF,0,$HALF,-1

And for Command Line 2, use:

wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz

Command 0 is for snapping the window to the left. Command 1 is for snapping the window to the right. Command 2 is for maximizing the window.

Still in the Commands section, open the Edge Bindings tab. Attach Command 0 to the left-hand side, Command 1 to the right-hand side and Command 2 to the top. You might get warnings about bindings existing for these options. Make sure to force the commands to these bindings.

Back on the main screen, enter the General Options screen. Find the Edge Trigger Delay option and set it to at least 500. This is the delay before a command is executed when something hits the edge of the screen. I’ve found that lower values cause a lot of problems with accidental detections.

Here is where I deviate from the tutorials mentioned above. First, I found that Edge Flipping was not allowing the snapping to take place. From the main screen, go to the Desktop Wall plugin. In the Edge Flipping tab, uncheck the Edge Flip Move option.

Also, the Snapping Windows plugin was causing problems, since your windows might get close enough to the top the screen, which it will then snap into place, which will then maximize, which might not be what you wanted. I disabled this plugin.

Slightly on-topic, if you want this functionality on your Mac, Cinch is great program and it will only cost you $7.

blog comments powered by Disqus