hammerspoon
hammerspoon copied to clipboard
Hammerspoon sometimes doesn't pick up keys bound to a modal
Sometimes hammerspoon will get into a state where I have a modal up, but it won't listen to any of the keys bound with the modal. When it's in this state, it happens consistently, as in I can re-create the modal and face the same issue. When I close the modal I see hotkey: Deleted hotkey ...
for each key in the modal, suggesting it was actually bound.
Seems to persist restarting Hammerspoon at the moment.
Running version 0.9.97 on Monterey 12.6
Any suggestions on how to get extra info to debug when in this state?
> xx = function() hs.alert("test") end
> xx()
> m = hs.hotkey.modal.new({}, nil)
> m:bind({}, "w", xx, nil, nil)
table: 0x600002834a40
> m:enter()
table: 0x600002834a40
-- I press 'w' a bunch here. No dice.
> m:bind({}, "W", xx, nil, nil)
table: 0x600002834a40
> m:exit()
table: 0x600002834a40
> m:delete()
2022-10-28 09:30:56: 09:30:56 hotkey: Deleted hotkey W
2022-10-28 09:30:56: hotkey: Deleted hotkey W
I noticed that they work fine if I add any mods, so it's only 'raw' key bindings that are the issue.
just want to chime in that it has happened to me too in the same way (Monterey 12.2.1):
- single chars with no modifiers broken, but not all of them, for me "Q" broke but "W" kept working
- problem persisted after HS restart
- I can't remember how the problem fixed itself but it was only broken for like half a day
It's been broken for me for a few days this time.
It never recovered. Bright side is that I can do a lot of testing. Bad side is that this makes hammerspoon just about useless to me. Would appreciate some suggestions on how to diagnose. If I change my bindings to use a mod they work, so it's only 'bare' hotkeys that are broken.
I have the same problem on Montery 12.6.1 with an Apple M1 macbook.
Only noticed it when I uninstalled Karabiner Elements. However, when I reinstall Karabiner Elements, it's all working again, so this might be a workaround…
I have also had this issue a few times. A workaround that has worked for me more than once is putting my computer to sleep and waking it back up.
I was able to fix this by changing my karabiner elements settings, though unfortunately I don't know what I needed to change. Looking at a diff it seems that I had custom settings for specific hardware (e.g. builtin vs external), and once I removed that it started working again for both.
just some side notes:
- as i remember
W
andw
are the same? you have to add ashift
modifier? - maybe macOS default hotkeys are overwriting the settings?
I have the same problem with hammerspoon 0.9.100. I'm also using Karabiner Elements. Only way to fix it I found so far is to log out and in again. Neither restarting hammerspoon nor Karabiner Elements helps. I don't know if its relevant, but I'm using spacehammer config
The modals are working after a fresh login and when they stop working I see the letters being send to to the window. So I don't think maxOS dfeault hotkeys or a missing shift modifier are the problem. Anything I can do to help finding the problem?
If something is stopping after some time: be sure that you hold a reference in a local variable so that the garbage collector not wipe it
if it was a garbage collector problem, would restarting hammerspoon not fix it?
Yes. Then restarting HS would solve it.
Has anyone found a fix for this?
I am on OSX Ventura and this is only fixed after logoff or restart of the mac, restarting hammerspoon does nothing. I am not using KE anymore since i only used it to swap FN and CTRL and this is supported by to OS now.
I am not sure how to debug this, could any one help.
My case is using WinMgr and when i enter modal mode, my commands with [ and ] work but with letter does not
moveAndResize = function(move)
return function()
spoon.WinWin:moveAndResize(move)
spoon.ModalMgr:deactivate({"resizeM"})
end
end
cmodal:bind('', 'f', 'Fullscreen', moveAndResize("fullscreen")) -- stops working
cmodal:bind('', '[', 'Half Left', moveAndResize("halfleft")) -- working fine
cmodal:bind('', ']', 'Half Right', moveAndResize("halfright")) -- working fine
This issue seems similar #3293
Has anyone found a fix for this?
I am on OSX Ventura and this is only fixed after logoff or restart of the mac, restarting hammerspoon does nothing. I am not using KE anymore since i only used it to swap FN and CTRL and this is supported by to OS now.
I am not sure how to debug this, could any one help.
My case is using WinMgr and when i enter modal mode, my commands with [ and ] work but with letter does not
moveAndResize = function(move) return function() spoon.WinWin:moveAndResize(move) spoon.ModalMgr:deactivate({"resizeM"}) end end cmodal:bind('', 'f', 'Fullscreen', moveAndResize("fullscreen")) -- stops working cmodal:bind('', '[', 'Half Left', moveAndResize("halfleft")) -- working fine cmodal:bind('', ']', 'Half Right', moveAndResize("halfright")) -- working fine
I have the same issue on M1 MacBook with MacOS 13.2.1. It seems only [0-9a-Z] not working, other key binding still work.
And I noticed that keypress at [0-9a-Z], won't be captured by hammerspoon, but directly get into whatever running at foremost. for example: If I call modalMgr while using MacVim, and Press key "i" which binds to open iTerm, but now MacVim captures this key press, and enter insert mode.
the issue is no longer there for me, hammerspoon 0.9.100 (6815), karabiner-elements 14.13.0, macos Ventura 13.6.7