Cross Platform System-wide Org-Capture

Filed in BSD, Emacs, F/OSS, GNU/Linux, Org-Mode, OS X, Unix, WindowsTags: , , , , , ,

Here’s how I leverage Emacs org-capture from wherever I am in Windows, OS X, and other Unix and Unix-like operating systems.

I use F9 as my global capture key. It will either switch to or launch Emacs and then send [Ctrl]-c c to trigger org-capture. This way, no matter what I’m working on I’m one keystroke away.


Install AutoHotKey and add the following to your autohotkey.ahk script:


; org-capture
If WinExist("ahk_class Emacs")
Send ^{c}
Send {c}
Run "runemacs.exe"
WinWaitActive, emacs
Send ^{c}
Send {c}


Save the file. Reload the script (right click on the notification icon and select “Reload This Script”). You can find the original version of this on my personal blog from 2011.

Gnu/Linux & BSD & Unix

Install autokey-gtk or autokey-qt depending on your desktop environment. In the main window create a new script and paste the following in:


import subprocess
command = 'wmctrl -l'
output = system.exec_command(command, getOutput=True)

if "emacs" in output:
    window.activate("emacs", switchDesktop=True)




Assign F9 to the hotkey. Click Save. Thanks to the autokey-users group for their help troubleshooting my typos!


There are two ways I’ve accomplished this. The first is to use Keyboard Maestro if you already have it. Create a new macro called Org-Capture that triggers on F9. Have it Activate Emacs, simulate keystroke Control-C, and simulate keystroke C.

If you don’t have Keyboard Maestro, you can use the following Applescript in Automator:


on run {input, parameters}

tell application "Emacs"
tell application "System Events"
keystroke "c" using {control down}
keystroke "c"
end tell
end tell

return input
end run


Save it as a service, and then in the Keyboard Shortcuts panel assign the service to F9.

Let me know how this works for you. Comments, suggestions, and recommendations are welcome as always.

Leave a Reply

%d bloggers like this: