-
Summarymy mouse event listener get sometimes disabled. but i don't know why. What i doi loaded all my hammerspoon stuff - and its working as expected until i fire a hotkey for an modal. at this moment my mouse listener is not working anymore. what i seesomehow the activation of an any ideas why this happening? Code Snippetsa) my mouse listener defined here: edit: code is updated - see answer - hs.eventtap.new({hs.eventtap.event.types.leftMouseDown}, checkCmdClickInMailmateAndActivateMailmate):start()
+ MailMateFocus_EventTap = hs.eventtap.new({hs.eventtap.event.types.leftMouseDown}, checkCmdClickInMailmateAndActivateMailmate):start() b) 2 of the modals are defined here: c) my choosers are here: d) and here is also a chooser: Exceptionsthis modals don't disable the mouse listener: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
ok - found a solution. it seems it got garbage collected, because after some time the function also stopped - so i add a global: hs.eventtap.new() changed to: MailMateFocusEventTap = hs.eventtap.new() note: a |
Beta Was this translation helpful? Give feedback.
-
It's been a while since I reviewed it, but I should probably get this added to the official Hammerspoon wiki at some point -- take a look at https://github.com/asmagill/hammerspoon/wiki/Variable-Scope-and-Garbage-Collection and it will show you how you can store the handler with a local variable and still prevent garbage collection. |
Beta Was this translation helpful? Give feedback.
ok - found a solution.
it seems it got garbage collected, because after some time the function also stopped - so i add a global:
changed to:
note: a
local
variable was not working...