-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhammerspoon.lua
34 lines (30 loc) · 1.6 KB
/
hammerspoon.lua
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
hs.window.animationDuration = 0
local hyper = hs.hotkey.modal.new({}, nil)
hs.hotkey.bind({}, 'F18', function() hyper:enter() end, function() hyper:exit() end)
hyper:bind({'shift'}, 'r', function() hs.reload() end)
hyper:bind({}, 'a', function() hs.window.focusedWindow():focusWindowWest() end)
hyper:bind({}, 'f', function() hs.window.focusedWindow():focusWindowEast() end)
hyper:bind({'shift'}, 'a', function() hs.window.focusedWindow():moveToUnit(hs.layout.left50) end)
hyper:bind({'shift'}, 'f', function() hs.window.focusedWindow():moveToUnit(hs.layout.right50) end)
hyper:bind({'shift'}, 'tab', function() hs.window.focusedWindow():maximize() end)
local focusApps = function(bundleIDs)
for _, bundleID in ipairs(bundleIDs) do
local app = hs.application.get(bundleID)
if app then
app:activate(true)
end
end
for _, w in ipairs(hs.window.visibleWindows()) do
local app = w:application()
if not hs.fnutils.contains(bundleIDs, app:bundleID()) then
app:hide()
end
end
end
hyper:bind({}, 'm', function() focusApps({'com.microsoft.teams2'}) end)
hyper:bind({}, 'i', function() focusApps({'com.tinyspeck.slackmacgap'}) end)
hyper:bind({}, 'j', function() focusApps({'com.bitwarden.desktop'}) end)
hyper:bind({}, 'k', function() focusApps({'com.apple.Safari', 'org.qutebrowser.qutebrowser'}) end)
hyper:bind({}, 'l', function() focusApps({'com.apple.reminders', 'org.mozilla.thunderbird'}) end)
hyper:bind({}, ';', function() focusApps({'com.mitchellh.ghostty'}) end)
hs.notify.new({title='Hammerspoon', informativeText='Configuration loaded'}):send()