aero snap functionality with compiz

After having tried different tiling window managers to improve my productivity and simplify management of all the windows my desktop usually consists of, I found a nice blog article and customized its approach a little further (Get Aero Snap in Ubuntu)

This will enable you to align windows left, right and maximized by either moving windows to the edges or pressing certain shortcuts (Meta+Left, -Right, -Up).

Despite following the instructions on the aforementioned website I made the following customizations:

Firstly, I didn’t set the Edge Triggers, because I couldn’t get used to them ;) Also, I added a command for removing the maximized state of a window. With my desktop settings, it appeared that a window on the left and a window on the right will overlap for a few pixels, so I also readjusted the command for right.

These are my final results for the commands:

Left
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
Right
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+2)),0,$(($HALF-2)),-1
Up
wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
Down
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz

Comments are closed.