I'm trying to run this in my /etc/init.d/rc.local. I had to manually add the exit 0 because it wasn't there by default if that makes any difference.
cd /home/john/xcape && ./xcape -e 'Control_L=Escape'
exit 0
So to check if it works, I run this, and it returns..
$ sudo service rc.local start
Unable to connect to X11 display. Is $DISPLAY set?
Yes, it is set.
$ echo $DISPLAY
john-Ubuntu:0
I went through this tutorial http://pic.dhe.ibm.com/infocenter/hatshelp/v80/index.jsp?topic=%2Fcom.ibm.hats.doc%2Fdoc%2Fudispenv.htm
I looked around on AskUbuntu and they all seem to point to this same step.