draw switcher indicator on screen

This commit is contained in:
Noah Masur 2022-04-16 16:50:03 -04:00
parent 244c431c75
commit ba3aa9cd93

View File

@ -8,17 +8,34 @@ obj.name = "Launcher"
obj.version = "0.1" obj.version = "0.1"
obj.license = "MIT - https://opensource.org/licenses/MIT" obj.license = "MIT - https://opensource.org/licenses/MIT"
function drawSwitcher()
-- Drawing
canv = hs.canvas.new({ x = 850, y = 1, h = 3, w = 120 })
canv[#canv + 1] = {
action = "build",
type = "rectangle",
}
canv[#canv + 1] = {
type = "rectangle",
fillColor = { alpha = 1, red = 0.8, green = 0.6, blue = 0.3 },
action = "fill",
}
return canv:show()
end
function obj:init() function obj:init()
-- Begin launcher mode -- Begin launcher mode
self.launcher = hs.hotkey.modal.new("ctrl", "space") self.launcher = hs.hotkey.modal.new("ctrl", "space")
-- Behaviors on enter -- Behaviors on enter
function self.launcher:entered() function self.launcher:entered()
-- hs.alert'Entered mode' -- hs.alert("Entered mode")
self.canv = drawSwitcher()
end end
-- Behaviors on exit -- Behaviors on exit
function self.launcher:exited() function self.launcher:exited()
-- hs.alert'Exited mode' -- hs.alert("Exited mode")
self.canv:hide()
end end
-- Use escape to exit launcher mode -- Use escape to exit launcher mode