#!/bin/sh if [ -z "$DISPLAY" ]; then echo "$0: no DISPLAY" >&2 exit 1 fi if ! wmctrl -a emacs; then echo "$0: wmctrl failed" >&2 exit 1 fi # It seems there is some kind of timing issue which requires this # sleep - probably we have to ensure that wmctrl has finished # switching before feeding the command to emacs. sleep 0.2 if true; then # Use M-x org-agenda; works regardless of key-binding or current # buffer. Also Escape should be more portable than Meta_L etc. xmacroplay $DISPLAY </dev/null KeyStr Escape String xorg-agenda KeyStr Return EOF else # Another way of doing it since I bind C-c C-a to `org-agenda', # but this only works if the current emacs buffer is in org-mode. xmacroplay $DISPLAY </dev/null KeyStrPress Control_L String ca KeyStrRelease Control_L EOF fi