GNU bug report logs - #44973
Add a macOS global hotkey function

Previous Next

Package: emacs;

Reported by: j <at> mremus.net

Date: Mon, 30 Nov 2020 21:27:02 UTC

Severity: minor

Full log


View this message in rfc822 format

From: j <at> mremus.net
To: 44973 <at> debbugs.gnu.org
Subject: bug#44973: Add a macOS global hotkey function
Date: Mon, 30 Nov 2020 13:01:52 -0800
[Message part 1 (text/plain, inline)]
MacOS makes it very difficult to assign global hotkeys to focus Emacs.
For example, if I'm in another program, and I want to launch/focus Emacs
with "Alt-SPC", it can't just be set in the system preferences; I'd need to
use a 3rd-party program like skhd.

Would it be possible to add a function or hook to Emacs which registers one
or more global hotkeys (using addGlobalMonitorForEventsMatchingMask), and
then when the hotkey is pressed, run an elisp function?

For example, by creating a "ns-register-global hotkey" function, where the
user could choose a keybinding (maybe "ALT-SPC"), and letting the user
provide a hook function (maybe "org-capture-stuff")

I intend this feature to be used for something like an Alfred replacement,
as described here: https://www.mattduck.com/emacs-fuzzy-launcher.html .

Even if it's rare for Emacs to implement an OS-specific feature, there is
some precedent on Windows. If you look at w32-register-hot-keys, it's
similar to, but different from my request.

The implementation in nsterm.m should be simple, but it requires Obj-C and
Emacs-specific development knowledge.

Thanks!
[Message part 2 (text/html, inline)]

This bug report was last modified 4 years and 163 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.