From 54034dd362fe84fcd8ac6012286a132db7e5c105 Mon Sep 17 00:00:00 2001 From: adamwagner Date: Sat, 28 Nov 2020 13:24:29 -0800 Subject: [PATCH 1/2] Guard against re-initialization of stackline. --- stackline/stackline.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stackline/stackline.lua b/stackline/stackline.lua index efc9bb7..94e1ceb 100644 --- a/stackline/stackline.lua +++ b/stackline/stackline.lua @@ -16,6 +16,11 @@ stackline.window = require 'stackline.stackline.window' function stackline:init(userConfig) -- {{{ log.i('starting stackline') + if stackline.manager then + -- guard against re-initializtion https://github.com/AdamWagner/stackline/issues/46#issuecomment-723527826 + return print('stackline already initialized') + end + -- Default window filter controls what windows hs "sees" -- Required before initialization self.wf = wf.new():setOverrideFilter{ -- {{{ From a50a4586d8e92876afa32c729fd011393a1343f1 Mon Sep 17 00:00:00 2001 From: adamwagner Date: Sat, 28 Nov 2020 16:08:22 -0800 Subject: [PATCH 2/2] Guard against nil indicator in Stack:getWindowByPoint() --- stackline/stack.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/stackline/stack.lua b/stackline/stack.lua index 6a241d1..a860507 100644 --- a/stackline/stack.lua +++ b/stackline/stack.lua @@ -70,6 +70,7 @@ end -- }}} function Stack:getWindowByPoint(point) -- {{{ local foundWin = u.filter(self.windows, function(w) + if not w.indicator then return false end local indicatorEls = w.indicator:canvasElements() local wFrame = hs.geometry.rect(indicatorEls[1].frame) return point:inside(wFrame)