hs.hotkey.bind('cmd', 'c', function()
hs.eventtap.keyStroke({'cmd'}, 'c', keyDelay)
hs.alert.show("Copy")
end)--
You received this message because you are subscribed to the Google Groups "Hammerspoon" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hammerspoon...@googlegroups.com.
To post to this group, send email to hamme...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/hammerspoon/52463925-f9ee-463f-87f9-6d09f88f3705%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi David,The following works for me, using hs.eventtap instead of hs.hotkey.bind to set up the binding:
hs.eventtap.new({hs.eventtap.event.types.keyDown},function(e)if (e:getCharacters() == "c" and e:getFlags():containExactly({"cmd"})) thenhs.alert.show("Copy")endreturn falseend):start()—Diego
On 15 Jan 2018, at 17:56, da...@thedavid.co.uk wrote:
I'm trying to use Hammerspoon to display an alert every time I press Cmd-C (sometimes I hit the keys wrong and I only realise when I try to paste, which is really annoying).The following code seems to get stuck – I imagine because the hotkey function gets called recursively through hs.eventtap.keyStroke()hs.hotkey.bind('cmd', 'c', function()
hs.eventtap.keyStroke({'cmd'}, 'c', keyDelay)
hs.alert.show("Copy")
end)Any tips on how I can get this working?--
You received this message because you are subscribed to the Google Groups "Hammerspoon" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hammerspoon+unsubscribe@googlegroups.com.