How to emit Cmd+Option+Esc to open "Force Quit"?

1 view
Skip to first unread message

Richard Michael

unread,
Jan 29, 2026, 7:32:18 PMJan 29
to Hammerspoon
Hello,

I'm new to HammerSpoon. Using v1.1, on macOS 14.8.2.

I have a configuration to tap-alone CapsLock to emit Esc, but it's not working in all scenarios.  For example, to launch "Force Quit".

Perhaps the key sequence is handled at lower-level than HammerSpoon, and this is not possible?

I'm debugging with a simplified configuration, without the spoon just Cmd+Option+f:

```
-- Press Cmd+Option+f to emit Cmd+Option+Escape
hs.hotkey.bind({"cmd", "alt"}, "f", function()
  hs.eventtap.keyStroke({"cmd", "alt"}, "escape", 1)
end)
```

Add logging:

```
-- Debug tap to log all key events
debugTap = hs.eventtap.new({hs.eventtap.event.types.keyDown, hs.eventtap.event.types.keyUp}, function(event)
  local keyCode = event:getKeyCode()
  local flags = event:getFlags()
  local typeName = (event:getType() == hs.eventtap.event.types.keyDown) and "keyDown" or "keyUp"
  hs.printf("DEBUG: %s keyCode=%s flags=%s", typeName, keyCode, hs.inspect(flags))
  return false
end)
debugTap:start()
```

The same "native" Cmd+Option+Esc key sequences are emitted (wrapped by the Cmd+Option+f):

```
-- 2026-01-27 15:56:31: Welcome to the Hammerspoon Console!
-- You can run any Lua code in here.

-- 2026-01-27 15:56:31: -- Lazy extension loading enabled
-- 2026-01-27 15:56:31: -- Loading ~/.hammerspoon/init.lua
-- 2026-01-27 15:56:31: -- Loading extension: console
-- 2026-01-27 15:56:31: -- Loading extension: image
-- 2026-01-27 15:56:31: -- Loading extension: eventtap
-- 2026-01-27 15:56:31: -- Loading extension: hotkey
-- 2026-01-27 15:56:31: 15:56:31     hotkey: Enabled hotkey ⌘⌥F
-- 2026-01-27 15:56:31: -- Done.
-- 2026-01-27 15:56:43: -- Loading extension: inspect
-- 2026-01-27 15:56:43: DEBUG: keyDown keyCode=3 flags={
--   alt = true,
--   cmd = true
-- }
-- 2026-01-27 15:56:43: DEBUG: keyDown keyCode=53 flags={
--   alt = true,
--   cmd = true
-- }
-- 2026-01-27 15:56:43: DEBUG: keyUp keyCode=53 flags={
--   alt = true,
--   cmd = true
-- }
-- 2026-01-27 15:56:43: DEBUG: keyUp keyCode=3 flags={
--   alt = true,
--   cmd = true
-- }
--
--
-- Below: Native command+option+esc opens `Force Quit`
--
--
-- 2026-01-27 15:52:50: DEBUG: keyDown keyCode=53 flags={
--   alt = true,
--   cmd = true
-- }
-- 2026-01-27 15:52:50: DEBUG: keyUp keyCode=53 flags={
--   alt = true,
--   cmd = true
-- }

```


Background:

I'm using the ControlEscape spoon to change CapsLock to Control, but tap-alone CapsLock to ESC.  It does not work with Cmd+Option+[tap CapsLock] to launch "Force Quit".

https://github.com/jasonrudolph/ControlEscape.spoon/issues/4


I've reduced the macOS native CapsLockDelayOverride, in case it interferes with CapsLock events:

hidutil property --set '{"CapsLockDelayOverride":10}'


I've read the FAQ, contributors guide, and some docs, and searched the group and GitHub Discussions but didn't find anything about limitations, special key sequences, or "Force Quit" specifically.

I used Karabiner-Elements to do this, and since it is an IOKit driver, I'm suspecting the issue might be handling underneath HammerSpoon.  At the HID driver, or windowserver/loginwindow?


Thanks for advice, regards,
Richard
Reply all
Reply to author
Forward
0 new messages