Skip to content

Commit

Permalink
Update hotkey.lua: add isActive
Browse files Browse the repository at this point in the history
add isActive
  • Loading branch information
muescha committed Feb 29, 2024
1 parent 56b5835 commit d78aeef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion extensions/hotkey/hotkey.lua
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ function hotkey.modal:enter()
end
for _,hk in ipairs(self.keys) do enable(hk,nil,true) end
self:entered()
self.isActive = true
return self
end

Expand All @@ -564,6 +565,7 @@ function hotkey.modal:exit()
if (self.k) then
enable(self.k)
end
self.isActive = false
self:exited()
log.d('Exited modal')
return self
Expand All @@ -589,7 +591,7 @@ end
--- Notes:
--- * If `key` is nil, no global hotkey will be registered (all other parameters will be ignored)
function hotkey.modal.new(mods, key, message)
local m = setmetatable({keys = {}}, hotkey.modal)
local m = setmetatable({keys = {}, isActive=false}, hotkey.modal)
if (key) then
m.k = hotkey.bind(mods, key, message, function() m:enter() end)
end
Expand Down

0 comments on commit d78aeef

Please sign in to comment.