mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-26 07:15:37 +00:00
autoformat hammerspoon and add calendar
This commit is contained in:
parent
b09a38201c
commit
6a0a27714b
@ -1,50 +1,77 @@
|
|||||||
--- === Launcher ===
|
--- === Launcher ===
|
||||||
|
|
||||||
local obj={}
|
local obj = {}
|
||||||
obj.__index = obj
|
obj.__index = obj
|
||||||
|
|
||||||
-- Metadata
|
-- Metadata
|
||||||
obj.name = 'Launcher'
|
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 obj:init()
|
function obj:init()
|
||||||
|
-- Begin launcher mode
|
||||||
|
self.launcher = hs.hotkey.modal.new("ctrl", "space")
|
||||||
|
|
||||||
-- Begin launcher mode
|
-- Behaviors on enter
|
||||||
self.launcher = hs.hotkey.modal.new('ctrl', 'space')
|
function self.launcher:entered()
|
||||||
|
-- hs.alert'Entered mode'
|
||||||
|
end
|
||||||
|
-- Behaviors on exit
|
||||||
|
function self.launcher:exited()
|
||||||
|
-- hs.alert'Exited mode'
|
||||||
|
end
|
||||||
|
|
||||||
-- Behaviors on enter
|
-- Use escape to exit launcher mode
|
||||||
function self.launcher:entered()
|
self.launcher:bind("", "escape", function()
|
||||||
-- hs.alert'Entered mode'
|
self.launcher:exit()
|
||||||
end
|
end)
|
||||||
-- Behaviors on exit
|
|
||||||
function self.launcher:exited()
|
|
||||||
-- hs.alert'Exited mode'
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Use escape to exit launcher mode
|
|
||||||
self.launcher:bind('', 'escape', function() self.launcher:exit() end)
|
|
||||||
|
|
||||||
-- Launcher shortcuts
|
|
||||||
self.launcher:bind('', 'space', function() hs.hints.windowHints(); self.launcher:exit() end)
|
|
||||||
self.launcher:bind('', 'return', function() self:switch('Alacritty.app') end)
|
|
||||||
self.launcher:bind('', 'D', function() self:switch('Discord.app') end)
|
|
||||||
self.launcher:bind('', 'E', function() self:switch('Mail.app') end)
|
|
||||||
self.launcher:bind('', 'F', function() self:switch('Firefox.app') end)
|
|
||||||
self.launcher:bind('', 'G', function() self:switch('Mimestream.app') end)
|
|
||||||
self.launcher:bind('', 'M', function() self:switch('Messages.app') end)
|
|
||||||
self.launcher:bind('', 'O', function() self:switch('Obsidian.app') end)
|
|
||||||
self.launcher:bind('', 'P', function() self:switch('System Preferences.app') end)
|
|
||||||
self.launcher:bind('', 'R', function() hs.reload() end)
|
|
||||||
self.launcher:bind('', 'S', function() self:switch('Slack.app') end)
|
|
||||||
self.launcher:bind('', 'Z', function() self:switch('zoom.us.app') end)
|
|
||||||
|
|
||||||
|
-- Launcher shortcuts
|
||||||
|
self.launcher:bind("", "space", function()
|
||||||
|
hs.hints.windowHints()
|
||||||
|
self.launcher:exit()
|
||||||
|
end)
|
||||||
|
self.launcher:bind("", "return", function()
|
||||||
|
self:switch("Alacritty.app")
|
||||||
|
end)
|
||||||
|
self.launcher:bind("", "C", function()
|
||||||
|
self:switch("Calendar.app")
|
||||||
|
end)
|
||||||
|
self.launcher:bind("", "D", function()
|
||||||
|
self:switch("Discord.app")
|
||||||
|
end)
|
||||||
|
self.launcher:bind("", "E", function()
|
||||||
|
self:switch("Mail.app")
|
||||||
|
end)
|
||||||
|
self.launcher:bind("", "F", function()
|
||||||
|
self:switch("Firefox.app")
|
||||||
|
end)
|
||||||
|
self.launcher:bind("", "G", function()
|
||||||
|
self:switch("Mimestream.app")
|
||||||
|
end)
|
||||||
|
self.launcher:bind("", "M", function()
|
||||||
|
self:switch("Messages.app")
|
||||||
|
end)
|
||||||
|
self.launcher:bind("", "O", function()
|
||||||
|
self:switch("Obsidian.app")
|
||||||
|
end)
|
||||||
|
self.launcher:bind("", "P", function()
|
||||||
|
self:switch("System Preferences.app")
|
||||||
|
end)
|
||||||
|
self.launcher:bind("", "R", function()
|
||||||
|
hs.reload()
|
||||||
|
end)
|
||||||
|
self.launcher:bind("", "S", function()
|
||||||
|
self:switch("Slack.app")
|
||||||
|
end)
|
||||||
|
self.launcher:bind("", "Z", function()
|
||||||
|
self:switch("zoom.us.app")
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function obj:switch(app)
|
function obj:switch(app)
|
||||||
hs.application.launchOrFocus(app)
|
hs.application.launchOrFocus(app)
|
||||||
self.launcher:exit()
|
self.launcher:exit()
|
||||||
end
|
end
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user