--
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/3e547fb4-11c7-4f89-aa3e-72e6259ec3b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
function keyRepeat(mods, key, delay, interval, repeatfn) local modal_key = hs.hotkey.modal.new(nil, nil) local key_repeat = false local timer timer = hs.timer.new(interval, function() if not key_repeat then timer:stop() else repeatfn() end end) modal_key:bind(mods, key, function() key_repeat = true repeatfn() hs.timer.doAfter(delay, function() if key_repeat then timer:start() end end) end, function() key_repeat = false timer:stop() end ) modal_key:enter()endkeyRepeat(ctrl_mod, 'j', 0.5, 0.1, function() hs.eventtap.event.newKeyEvent(no_mod, 'down', true):post() end)keyRepeat(ctrl_mod, 'k', 0.5, 0.1, function() hs.eventtap.event.newKeyEvent(no_mod, 'up', true):post() end)keyRepeat(ctrl_mod, 'h', 0.5, 0.1, function() hs.eventtap.event.newKeyEvent(no_mod, 'left', true):post() end)keyRepeat(ctrl_mod, 'l', 0.5, 0.1, function() hs.eventtap.event.newKeyEvent(no_mod, 'right', true):post() end)I'd like to be able to, say, move a window in a direction continuously by holding a hotkey. Could this be accomplished with modal hotkeys? Maybe using the pressedfn to activate a move and the releasedfn to stop it?Thanks,
HiAt the moment, no, we trigger callbacks when the keys are initially pressed down.Out of interest, what's your use case for repeating hotkeys?Cheers,--Chris Jones
Is there a way to do automatic hotkey repeat when a hotkey is held?--Thanks,Max
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.
I thought this message was newer but anyway I implemented my own function for dealing with this
Chris: That's odd, given that the keyboard preferences have options for key repeat. But I'd vote to have it be added to hs.hotkey, since otherwise, people will just be copy-pasting it wholesale into their inits, and that seems to go against the modularity of Mjolnir and the abstraction of Hammerspoon.