From d78aeef83fd0d1288270efb4caf82fc1cdba0d9c Mon Sep 17 00:00:00 2001 From: Muescha <184316+muescha@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:03:47 +0100 Subject: [PATCH 1/2] Update hotkey.lua: add isActive add isActive --- extensions/hotkey/hotkey.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/hotkey/hotkey.lua b/extensions/hotkey/hotkey.lua index b2b0ce300..9aca7c118 100644 --- a/extensions/hotkey/hotkey.lua +++ b/extensions/hotkey/hotkey.lua @@ -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 @@ -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 @@ -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 From 7e389a0dd42a2608a96315ef513abe858d26bb9b Mon Sep 17 00:00:00 2001 From: Muescha <184316+muescha@users.noreply.github.com> Date: Fri, 9 Aug 2024 02:03:03 +0200 Subject: [PATCH 2/2] Update hotkey.lua: Hide implementation of isActive --- extensions/hotkey/hotkey.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/extensions/hotkey/hotkey.lua b/extensions/hotkey/hotkey.lua index 9aca7c118..80136de96 100644 --- a/extensions/hotkey/hotkey.lua +++ b/extensions/hotkey/hotkey.lua @@ -544,7 +544,7 @@ function hotkey.modal:enter() end for _,hk in ipairs(self.keys) do enable(hk,nil,true) end self:entered() - self.isActive = true + self._isActive = true return self end @@ -565,7 +565,7 @@ function hotkey.modal:exit() if (self.k) then enable(self.k) end - self.isActive = false + self._isActive = false self:exited() log.d('Exited modal') return self @@ -591,7 +591,8 @@ 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 = {}, isActive=false}, hotkey.modal) + local m = setmetatable({keys = {}}, hotkey.modal) + m._isActive = false if (key) then m.k = hotkey.bind(mods, key, message, function() m:enter() end) end @@ -617,4 +618,8 @@ function hotkey.modal:delete() end end +function hotkey.modal:isActive() + return self._isActive +end + return hotkey