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.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()
-- Begin launcher mode
self.launcher = hs.hotkey.modal.new("ctrl", "space")
-- Behaviors on enter
function self.launcher:entered()
-- hs.alert'Entered mode'
-- hs.alert("Entered mode")
self.canv = drawSwitcher()
end
-- Behaviors on exit
function self.launcher:exited()
-- hs.alert'Exited mode'
-- hs.alert("Exited mode")
self.canv:hide()
end
-- Use escape to exit launcher mode