mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-22 14:35:37 +00:00
draw switcher indicator on screen
This commit is contained in:
parent
244c431c75
commit
ba3aa9cd93
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user