diff options
author | Teddy Wing | 2019-06-19 23:33:26 +0200 |
---|---|---|
committer | Teddy Wing | 2019-06-19 23:33:26 +0200 |
commit | 2e5cc43d7d25295a14d634b53af48a6449cd909f (patch) | |
tree | 57c7788c6022b9942fe7554ca5b11a9f5347d255 | |
parent | 11a077d48f0246a98f71465a9f3c54d8a7fcc3a3 (diff) | |
download | dothammerspoon-2e5cc43d7d25295a14d634b53af48a6449cd909f.tar.bz2 |
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.
-rw-r--r-- | terminal_tab_hotkeys.lua | 8 |
1 files changed, 4 insertions, 4 deletions
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) |