Setting Up Easystroke on Ubuntu

Easystroke is a gesture recognition tool that runs in Linux. This is a brief tutorial of how to get it up and running in Ubuntu with some basic, useful examples of gestures.

Packages

easystroke: gesture recognition program
wmctrl: control an EWMH/NetWM compatible X Window Manager
xdotool: simulate X11 keyboard/mouse input

Installation

$ sudo apt-get install easystroke wmctrl xdotool

Note that easystroke will store its configuration in  ~/.easystroke/ - you may wish to add this directory to your backups.

From the menu, start easystroke. It will appear as a small icon in the tray area. Click this icon, choose the Preferences tab and ensure "Autostart easystroke" is checked. This will ensure it starts each time you log in.

Adding Actions

In this example we shall run gnome-terminal with a mouse gesture.

In easystroke, click the Preferences tab and make a mental note of the "Gesture Button" (and optionally change it). This is the mouse button that you hold down whilst making the gesture.

In easystroke, click the Actions tab and click the button to "Add Action". Name it as "Terminal". Click in the "Type" cell to ensure it is set to "Command". Click in the "Details" cell and type in "gnome-terminal" and press Enter to accept it.

With the action row selected, click the "Record Stroke" button to record the gesture that will activate this command. Hold the "Gesture Button" down (as per your mental note from the Preferences section) and draw the gesture on the screen. I drew a letter "T" to remind me it's going to run the gnome-terminal. Your gesture is now created and ready to use.

Using the Gesture

Hold down the "Gesture Button" and draw the gesture you've just made. If all has gone well it should launch the gnome-terminal.

Collection of Useful Actions

Some actions are not directly supported by the built-in types. For these we can make use of wmctrl and xdotool. Note the use of wmctrl to switch focus to the existing process or start it if it isn't already running. Note also the time delays in xdotool usage; it's a bit hacky and you might need to change it.

Name Type Details
Prev Window
Command xdotool key Alt_L+Shift_L+Tab
Resize Window
Command xdotool key --delay 50ms alt+space key r
Move Window
Command xdotool key --delay 50ms alt+space key m
Firefox Command wmctrl -a Firefox || firefox
Next Window
Command xdotool key Alt_L+Tab
Minimize Command xdotool key --delay 50ms alt+space key n
Maximize Command xdotool key --delay 50ms alt+space key x
Close Command xdotool key alt+F4
Evolution Command wmctrl -a Evolution || evolution
Close Tab
Command xdotool key ctrl+w
Terminal Command
terminator
Update
Command
xdotool type "sudo apt-get update ; sudo apt-get -y upgrade ; sudo apt-get -y dist-upgrade" ; xdotool key KP_Enter

easystroke gestures


Got actions you'd like to share? Feel free to sign in and post them in the page comments. :)

Comments