Feature Request: I would like to know if a modal is in the state active
muescha opened this issue · comments
Muescha commented
I would like to know if a modal is in the state active
local ks = hs.hotkey.modal.new(
mod,
key,
description);
ks:isActive()
ks.isActive -- call value direct
I can do a workaround like this:
function hotkeybindmodal(mod, key, description, startFn, exitFn)
local active = false
local ks = hs.hotkey.modal.new(
mod,
key,
description);
function ks:entered()
debugInfo("Start Modal Mode for ".. description)
startFn()
active = true
end
function ks:exited()
active = false
exitFn()
debugInfo("Exit Modal Mode for ".. description)
end
function ks:isActive()
return active
end
return ks
end
and use it:
local ks = hotkeybindmodal(
mod,
key,
description);
ks:enter()
print(ks:isActive())