From eb99ec48f71675b64a507ae97d3c92aa97720827 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Thu, 21 Apr 2022 17:26:34 -0400 Subject: [PATCH] make switcher visuals adaptive --- hammerspoon.symlink/Spoons/Launcher.spoon/init.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hammerspoon.symlink/Spoons/Launcher.spoon/init.lua b/hammerspoon.symlink/Spoons/Launcher.spoon/init.lua index 3ace40d..50f0a58 100644 --- a/hammerspoon.symlink/Spoons/Launcher.spoon/init.lua +++ b/hammerspoon.symlink/Spoons/Launcher.spoon/init.lua @@ -10,7 +10,14 @@ obj.license = "MIT - https://opensource.org/licenses/MIT" function drawSwitcher() -- Drawing - canv = hs.canvas.new({ x = 850, y = 1, h = 3, w = 120 }) + width = hs.screen.mainScreen():fullFrame().w + switcherWidth = 500 + canv = hs.canvas.new({ + x = width / 2 - switcherWidth / 2, + y = 1, + h = 3, + w = switcherWidth, + }) canv[#canv + 1] = { action = "build", type = "rectangle", @@ -66,6 +73,9 @@ function obj:init() self.launcher:bind("", "F", function() self:switch("Firefox.app") end) + self.launcher:bind("", "H", function() + self:switch("Hammerspoon.app") + end) self.launcher:bind("", "G", function() self:switch("Mimestream.app") end)