reset launcher location on every launch

This commit is contained in:
Noah Masur 2024-03-26 12:23:27 -04:00
parent f73c52e2b7
commit 5d34ed5a68

View File

@ -10,6 +10,19 @@ obj.license = "MIT - https://opensource.org/licenses/MIT"
local screen = hs.screen.primaryScreen() local screen = hs.screen.primaryScreen()
local switcherWidth = 500 local switcherWidth = 500
function obj:init()
-- Begin launcher mode
if self.launcher == nil then
self.launcher = hs.hotkey.modal.new("ctrl", "space")
print(self.canvas)
print(obj.canvas)
end
-- Behaviors on enter
function self.launcher:entered()
-- hs.alert("Entered mode")
obj.canvas = hs.canvas.new({ obj.canvas = hs.canvas.new({
x = (screen:fullFrame().x + screen:fullFrame().w) / 2 - switcherWidth / 2, x = (screen:fullFrame().x + screen:fullFrame().w) / 2 - switcherWidth / 2,
y = 1, y = 1,
@ -26,26 +39,13 @@ obj.canvas[#obj.canvas + 1] = {
fillColor = { alpha = 1, red = 0.8, green = 0.6, blue = 0.3 }, fillColor = { alpha = 1, red = 0.8, green = 0.6, blue = 0.3 },
action = "fill", action = "fill",
} }
function obj:init()
-- Begin launcher mode
if self.launcher == nil then
self.launcher = hs.hotkey.modal.new("ctrl", "space")
print(self.canvas)
print(obj.canvas)
end
-- Behaviors on enter
function self.launcher:entered()
-- hs.alert("Entered mode")
obj.canvas:show() obj.canvas:show()
end end
-- Behaviors on exit -- Behaviors on exit
function self.launcher:exited() function self.launcher:exited()
-- hs.alert("Exited mode") -- hs.alert("Exited mode")
obj.canvas:hide() obj.canvas:delete(0.2)
end end
-- Use escape to exit launcher mode -- Use escape to exit launcher mode