Quick Macro Record/Playback Keyboard Shortcuts


Something I came across from this page
http://askubuntu.com/questions/515185/run-several-xdotool-commands-in-one-line-separated-from-each-other.

It’s a pretty awesome way to quickly record and playback macros. Install xmacro using this guy:

sudo apt-get install xmacro

And then to record, bind a keyboard shortcut like CTRL-F7 to this:

timeout 120 bash -c 'notify-send "Recording macro; press ESC to stop" ; xmacrorec2 -k 9 > ~/.last_xmacro ; notify-send "Recording macro finished; use F7 to play it"'

Use ESC to stop recording!

And to playback, bind F7 to this:

bash -c 'notify-send "Playing back macro on $DISPLAY" ; xmacroplay "$DISPLAY" < ~/.last_xmacro'

To fine tune, you can edit the ~/.last_macro file using the xmacro syntax, including adding in some Delay [sec]‘s.