Enable aero-snap functions in Ubuntu using nothing more than your mouse thanks to this simple tutorial by Misterpah who has kindly let us publish it here.
After being impressed with gesture-based features in Apple products Misterpah wondered: “Does Ubuntu have Gesture recognitions?”
Better still he thought “I would love a Mouse Gesture Recognition application.”
After a bit of Google-ing he found ‘Easystroke’ via a Lifehacker Post. “The Application itself can’t do anything than detecting what you draw ( you draw the gesture by holding middle mouse button ) and [run] a command. Well, that’s un-impressive. But then i remembered a tool which I like: wmctrl.
Wmctrl was used in a previous OMG! Ubuntu! tutorial for getting an aero snap effect in Ubuntu. Whilst that method works okay Misterpah found that by combining Easystroke with wmctrl he could invoke the same effect but using mouse gestures.
The steps are simple:
Using Easystroke to invoke wmctrl
Open up Easystroke from ‘Applications > Universal Access’
Hit the ‘Add Action’ button and enter each of the following commands individually: -
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
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
wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz && wmctrl -r :ACTIVE: -e 0,250,250,800,600
PS : In case you try and it fails, it may be because of the quote. The quote is the key beside the enter. replace the quote ( ‘ ) with the single quote beside the enter key.
Add the gestures/strokes
Now proceed to add the ‘strokes’ that will invoke the actions by highlighting each action in turn, choosing the ‘Record Stroke’ button and creating the following strokes: -
Many, many thanks to Mistapah