A Shortcut Manager for My Emacs-centric Workstation

At first glance, this post might appear to be of interest only to Mac users but most of the ideas also apply to other systems. As I’ve written many times, Emacs is at the center of my computing workflow. Almost everything I do, I do in Emacs. The only major exception is browsing for which I use Safari. Of course, other things are always going on—my continual Backblaze backup, for example—but I don’t normally interact with those.

Because I run Emacs and Safari in full screen on their own pages, it’s important that I have a quick and easy way of switching between them. I also want to bring up an Org capture buffer from anywhere in the system. I do all these things by assigning systemwide function keys to the desired action. Thus F6 switches to Emacs and F7 to Safari.

I used to do all that through Quicksilver but it’s really more heavy duty than I need since all I’m interested in is mapping shortcuts to actions. I’ve long considered getting one of the key mappers available for the Mac but as I mentioned in my Emacsclient and macOS post, I recently learned about iCanHazShortcut, which does just what I need. I specify a key combination and the desired operation and iCanHazShortcut takes care of the rest.

One of the tricky things on a Mac is telling the system to switch to an app—Emacs, say—rather than starting a new instance. It turns out that the proper command line invocation is open -a emacs. Now I have a simple and lightweight way of switching between Emacs and Safari.

That leaves only invoking a capture buffer from outside Emacs. This is the thing I’ve had the most trouble with historically. I used to use a bit of applescript to do it but it didn’t always work and other methods I tried worked even less well. Then I found Alphapappa’s yequake. It does just what I need and I can easily invoke it with iCanHazShortcut: I have it mapped to F9.

Finally, I had to deal with the touch strip on my MacBook. It likes to present different “buttons” depending on what app has focus but you can set it to always display the function keys and bring up the other buttons with the fn key.

Naturally, most of this will work on any system. You’ll have to find a key mapper appropriate to your OS but other than that, the ideas in this post should travel well.

This entry was posted in General and tagged . Bookmark the permalink.