-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.hammerspoon.init.lua
More file actions
102 lines (93 loc) · 2.76 KB
/
.hammerspoon.init.lua
File metadata and controls
102 lines (93 loc) · 2.76 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
local appShortcutMap = {
a = "Microsoft Teams",
b = "Google Chrome",
c = "GCalendar",
e = "Google Meet",
f = "Salesforce",
g = "Glean",
k = "Google Tasks",
m = "Gmail",
n = "Noteszzz",
o = "Emojis",
p = "Perplexity",
r = "reload",
s = "Slack",
t = "Ghostty",
u = "Music",
v = "Visual Studio Code",
z = "Zoom.us"
}
local hyperKey = {'shift', 'control', 'option', 'command'}
local mehKey = {'shift', 'control', 'option'}
--------------------------------------------------
-- load spoons
--------------------------------------------------
hs.loadSpoon("Emojis")
--------------------------------------------------
-- app launcher - launch apps based on a hotkey combination
--------------------------------------------------
for key, val in pairs(appShortcutMap) do
-- emojis
if val == "Emojis" then
spoon.Emojis:bindHotkeys({
toggle = { hyperKey, "o" }
})
-- reloader
elseif val == "reload" then
hs.hotkey.bind(hyperKey, "r", function()
hs.reload()
end)
-- app launcher
else
hs.hotkey.bind(hyperKey, key, function()
hs.application.launchOrFocus(val)
end)
end
end
--------------------------------------------------
-- mute microphone
--------------------------------------------------
function toggleMute()
local teams = hs.application.find("com.microsoft.teams2")
local zoom = hs.application.find("us.zoom.xos")
local googleMeet = hs.application.find("Google Meet") -- assumes that a chrome web app is saved of this name
local slack = hs.application.find("Slack")
if zoom then
--hs.alert.show("found zoom")
hs.eventtap.keyStroke({"cmd","shift"}, "a", 0, zoom)
end
if teams then
--hs.alert.show("found teams")
hs.eventtap.keyStroke({"cmd", "shift"}, "m", 0, teams)
end
if googleMeet then
--hs.alert.show("found google meet")
hs.eventtap.keyStroke({"cmd"}, "d", 0, googleMeet)
end
if slack then
--hs.alert.show("found slack")
hs.eventtap.keyStroke({"cmd", "shift"}, "space", 0, slack)
end
end
-- Bind the hotkey to the toggleMute function
hs.hotkey.bind(mehKey, "m", toggleMute)
--------------------------------------------------
-- print key strokes where the cursor is
--------------------------------------------------
-- print date
hs.hotkey.bind(mehKey, "d", function()
local dateString = os.date("%Y-%m-%d")
hs.eventtap.keyStrokes(dateString)
end)
-- print date and time
hs.hotkey.bind(mehKey, "t", function()
local dateString = os.date("%Y-%m-%dT%H:%M:%S")
hs.eventtap.keyStrokes(dateString)
end)
--------------------------------------------------
-- misc
--------------------------------------------------
hs.hotkey.bind(hyperKey, "w", function()
hs.alert.show("Hello World!")
end)
hs.alert.show("settings reloaded")