-
Notifications
You must be signed in to change notification settings - Fork 3
/
init.lua
105 lines (95 loc) · 2.52 KB
/
init.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
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
103
104
105
local FS = require("hs.fs")
local window = require("hs.window")
local ipc = require("hs.ipc")
local hs = hs
local transientApps = {
["LaunchBar"] = {allowRoles = "AXSystemDialog"},
["1Password 7"] = {allowTitles = "1Password mini"},
["Spotlight"] = {allowRoles = "AXSystemDialog"},
["Paletro"] = {allowRoles = "AXSystemDialog"},
["Contexts"] = false,
["Emoji & Symbols"] = true
}
local layoutSwitcherIgnored = {"at.obdev.LaunchBar", "com.contextsformac.Contexts"}
local appQuitterConfig = {
launchdRunInterval = 600, --- 10 minutes
rules = require("appquitter_rules"),
defaultQuitInterval = 14400, -- 4 hours
defaultHideInterval = 1800 -- 30 minutes
}
local hyper = {"shift", "cmd", "alt", "ctrl"}
local globalShortcuts = {
globals = {
rightClick = {hyper, "o"},
focusDock = {
{"cmd", "alt"},
"d"
}
},
windowManager = {
pushLeft = {hyper, "left"},
pushRight = {hyper, "right"},
pushUp = {hyper, "up"},
pushDown = {hyper, "down"},
maximize = {hyper, "return"},
center = {hyper, "c"}
},
notificationCenter = {
firstButton = {hyper, "1"},
secondButton = {hyper, "2"},
thirdButton = {hyper, "3"},
toggle = {hyper, "n"}
}
}
-- HAMMERSPOON SETTINGS, VARIABLES
hs.allowAppleScript(true)
hs.autoLaunch(true)
hs.automaticallyCheckForUpdates(true)
hs.menuIcon(false)
hs.dockIcon(false)
hs.hotkey.setLogLevel("error")
hs.keycodes.log.setLogLevel("error")
hs.logger.defaultLogLevel = "error"
ipc.cliUninstall()
ipc.cliInstall()
window.animationDuration = 0
-- SPOONS
-- load
local iterFn, dirObj = FS.dir("Spoons/")
if iterFn then
for file in iterFn, dirObj do
if string.sub(file, -5) == "spoon" then
local spoonName = string.sub(file, 1, -7)
hs.loadSpoon(spoonName)
end
end
end
-- start (ORDER MATTERS!)
spoon.AppQuitter:start(appQuitterConfig)
spoon.AppShortcuts:start(transientApps)
spoon.ConfigWatcher:start()
spoon.DownloadsWatcher:start(require "downloadswatcher_rules")
spoon.WifiWatcher:start(require "wifiwatcher_rules")
spoon.URLHandler:start()
spoon.StatusBar:start()
spoon.KeyboardLayoutManager:start(layoutSwitcherIgnored, "ABC")
spoon.GlobalShortcuts:bindHotKeys(globalShortcuts.globals)
spoon.WindowManager:bindHotKeys(globalShortcuts.windowManager):start()
spoon.NotificationCenter:bindHotKeys(globalShortcuts.notificationCenter)
hs.hotkey.bind(
hyper,
"t",
function()
hs.osascript.applescript(
[[
if app "iTerm" is not frontmost then
tell app "iTerm" to activate
else
tell app "System Events" to set visible of application process "iTerm2" to false
end if
]]
)
end,
nil,
nil
)