From 2e5cc43d7d25295a14d634b53af48a6449cd909f Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 19 Jun 2019 23:33:26 +0200 Subject: terminal_tab_hotkeys: Fix errors in enable/disable loops Since the `terminal_tab_hotkeys` table had both hotkey objects and methods in it, the loops that enable and disable the hotkeys were also looping over the functions, resulting in errors like this: 2019-06-19 23:30:09: ******** 2019-06-19 23:30:09: 23:30:09 ERROR: LuaSkin: hs.application.watcher callback: $HOME/.hammerspoon/terminal_tab_hotkeys.lua:42: attempt to index a function value (local 'v') stack traceback: $HOME/.hammerspoon/terminal_tab_hotkeys.lua:42: in method 'enable' $HOME/.hammerspoon/terminal_tab_hotkeys.lua:55: in function <$HOME/.hammerspoon/terminal_tab_hotkeys.lua:52> 2019-06-19 23:30:09: ******** Go the easy route and just change the methods into functions so that we only put hotkeys in the tables. --- terminal_tab_hotkeys.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'terminal_tab_hotkeys.lua') diff --git a/terminal_tab_hotkeys.lua b/terminal_tab_hotkeys.lua index 44dd633..8d7c61e 100644 --- a/terminal_tab_hotkeys.lua +++ b/terminal_tab_hotkeys.lua @@ -34,13 +34,13 @@ for i=0,9 do end) end -function terminal_tab_hotkeys:enable() +function terminal_tab_hotkeys_enable() for _, v in pairs(terminal_tab_hotkeys) do v:enable() end end -function terminal_tab_hotkeys:disable() +function terminal_tab_hotkeys_disable() for _, v in pairs(terminal_tab_hotkeys) do v:disable() end @@ -49,9 +49,9 @@ end application_watcher = hs.application.watcher.new(function(app_name, event_type, app) if app ~= nil and app_name == 'Terminal' then if event_type == hs.application.watcher.activated then - terminal_tab_hotkeys:enable() + terminal_tab_hotkeys_enable() elseif event_type == hs.application.watcher.deactivated then - terminal_tab_hotkeys:disable() + terminal_tab_hotkeys_disable() end end end) -- cgit v1.2.3