-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhammerspoon
43 lines (37 loc) · 1.99 KB
/
hammerspoon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
-- vim: set filetype=lua
-- init.lua
local apps = {
{modifiers = {"command", "ctrl"}, key = "d", appName = 'docker desktop', appPath = "/Applications/Docker.app"},
{modifiers = {"command", "ctrl"}, key = "f", appName = 'finder', appPath = "/System/Library/CoreServices/Finder.app"},
{modifiers = {"command", "ctrl"}, key = "i", appName = 'intellij idea', appPath = "/Applications/IntelliJ IDEA.app"},
{modifiers = {"command", "ctrl"}, key = "k", appName = 'slack', appPath = "/Applications/Slack.app"},
{modifiers = {"command", "ctrl"}, key = "l", appName = 'alacritty', appPath = "/Applications/Alacritty.app"},
{modifiers = {"command", "ctrl"}, key = "m", appName = 'chrome', appPath = "/Applications/Google Chrome.app"},
{modifiers = {"command", "ctrl"}, key = "n", appName = 'evernote', appPath = "/Applications/Evernote.app"},
{modifiers = {"command", "ctrl"}, key = "o", appName = 'zoom', appPath = "/Applications/zoom.us.app"},
{modifiers = {"command", "ctrl"}, key = "v", appName = 'preview', appPath = "/Applications/Preview.app"},
{modifiers = {"command", "ctrl"}, key = "p", appName = 'spotify', appPath = "/Applications/Spotify.app"},
{modifiers = {"command", "ctrl"}, key = "s", appName = 'mongodb compass', appPath = "/Applications/MongoDB Compass.app"},
{modifiers = {"command", "ctrl"}, key = "u", appName = 'tuple', appPath = "/Applications/Tuple.app"}
}
for _, appDetails in ipairs(apps) do
hs.hotkey.bind(appDetails.modifiers, appDetails.key, function()
local app = hs.application.find(appDetails.appName)
if app then
app:setFrontmost(true)
end
hs.application.launchOrFocus(appDetails.appPath)
end)
end
-- Send esc `ctrl + return`
hs.hotkey.bind({"control"}, "return", function()
hs.eventtap.keyStroke({}, "escape")
end)
-- Send ` using `option + '`
-- Send ~ using `shift + option + '`
hs.hotkey.bind({"option"}, "'", function()
hs.eventtap.keyStroke({}, "`")
end)
hs.hotkey.bind({"shift", "option"}, "'", function()
hs.eventtap.keyStroke({"shift"}, "`")
end)