-
Notifications
You must be signed in to change notification settings - Fork 3
/
ki-config.lua
349 lines (326 loc) · 16.8 KB
/
ki-config.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
----------------------------------------------------------------------------------------------------
-- Ki Config File
--
local Ki = spoon.Ki
local Mode = Ki.Mode
local Remaps = Ki.Remaps
local ModeTransitions = Ki.ModeTransitions
local File = spoon.Ki.File
local Website = spoon.Ki.Website
local Application = spoon.Ki.Application
local defaultEntities = spoon.Ki.defaultEntities.entity
-- Helper function to require entity config
local function requireEntity(type, file)
local directory = type == "entity" and "entities" or type.."s"
return require("ki-entities/"..directory.."/"..file)
end
----------------------------------------------------------------------------------------------------
-- Remap Website Mode transition shortcuts
--
Remaps {
-- NORMAL --
{
mode = "normal",
name = "Enter Website Mode",
shortcut = { { "cmd" }, "u" },
},
-- ENTITY --
{
mode = "entity",
name = "Enter Website Mode",
shortcut = { { "cmd" }, "u" },
},
{
mode = "entity",
name = "App Store",
shortcut = { { "cmd" }, "a" },
},
-- SELECT --
{
mode = "select",
name = "Enter Website Mode",
shortcut = { { "cmd" }, "u" },
},
}
----------------------------------------------------------------------------------------------------
-- Create custom ki entities
--
-- Create custom Website entities
local websites = {
-- Basic inline Website entities
APNews = Website { name = "AP News", url = "https://www.apnews.com" },
Dropbox = Website { name = "Dropbox", url = "https://www.dropbox.com" },
Lobsters = Website { name = "Lobsters", url = "http://lobste.rs" },
Oreilly = Website { name = "Oreilly", url = "http://oreilly.com" },
Synchrony = Website { name = "Synchrony", url = "https://securelogin.synchronybank.com" },
Upgrade = Website { name = "Upgrade", url = "https://www.upgrade.com/portal/" },
-- Externally defined Website entities
Airbnb = requireEntity("website", "airbnb"),
Amazon = requireEntity("website", "amazon"),
BankOfAmerica = requireEntity("website", "bank-of-america"),
BBC = requireEntity("website", "bbc"),
CapitalOne = requireEntity("website", "capital-one"),
Chase = requireEntity("website", "chase"),
Crunchbase = requireEntity("website", "crunchbase"),
DuckDuckGo = requireEntity("website", "duckduckgo"),
Etsy = requireEntity("website", "etsy"),
FacebookMessenger = requireEntity("website", "messenger"),
Github = requireEntity("website", "github"),
Glassdoor = requireEntity("website", "glassdoor"),
Google = requireEntity("website", "google"),
GoogleMaps = requireEntity("website", "google-maps"),
Hammerspoon = requireEntity("website", "hammerspoon"),
HammerspoonDocs = requireEntity("website", "hammerspoon-docs"),
LearnXInYMinutes = requireEntity("website", "learnxinyminutes"),
Letterboxd = requireEntity("website", "letterboxd"),
LinkedIn = requireEntity("website", "linkedin"),
MonarchMoney = requireEntity("website", "monarch-money"),
MyAnimeList = requireEntity("website", "myanimelist"),
NPM = requireEntity("website", "npm"),
NPR = requireEntity("website", "npr"),
NYTimes = requireEntity("website", "nytimes"),
Netflix = requireEntity("website", "netflix"),
Reddit = requireEntity("website", "reddit"),
StackOverflow = requireEntity("website", "stackoverflow"),
Wikipedia = requireEntity("website", "wikipedia"),
Yelp = requireEntity("website", "yelp"),
YouTube = requireEntity("website", "youtube"),
ZeroTier = requireEntity("website", "zerotier"),
}
-- Create custom file entities
local files = {
Code = File "~/Code",
TV = File "~/Movies/TV",
Dropbox = File "~/Dropbox",
}
-- Initialize LIFX light
local LIFX = requireEntity("entity", "lifx")
local BedroomLIFX = LIFX {
name = "Bedroom Light",
selector = "label:Main",
}
-- Create custom application entities
local entities = {
-- Initialize basic application entities inline
Alacritty = Application "Alacritty",
Cron = Application "Cron",
Discord = Application "Discord",
Firefox = Application "Firefox",
Gitter = Application "Gitter",
LimeChat = Application "LimeChat",
Messenger = Application "Messenger",
Obsidian = Application "Obsidian",
ParallelsDesktop = Application "Parallels Desktop",
Plex = Application "Plex",
Postico = Application "Postico",
ProtonVPN = Application "ProtonVPN",
Signal = Application "Signal",
Slack = Application "Slack",
VisualStudioCode = Application "Visual Studio Code",
-- Require externally defined application entities
["1Password"] = requireEntity("application", "1password"),
Arc = requireEntity("application", "arc"),
Fantastical = requireEntity("application", "fantastical"),
IINA = requireEntity("application", "iina"),
Hammerspoon = requireEntity("application", "hammerspoon"),
iTerm = requireEntity("application", "iterm"),
Java = requireEntity("application", "java"),
LINE = requireEntity("application", "line"),
MicrosoftExcel = requireEntity("application", "microsoft-excel"),
MEGASync = requireEntity("application", "MEGASync"),
MicrosoftOutlook = requireEntity("application", "microsoft-outlook"),
MicrosoftWord = requireEntity("application", "microsoft-word"),
ScriptEditor = requireEntity("application", "script-editor"),
TablePlus = requireEntity("application", "tableplus"),
VMWareFusion = requireEntity("application", "vmware-fusion"),
VLC = requireEntity("application", "vlc"),
Zoom = requireEntity("application", "zoom"),
-- Require other (non-application) entities
BedroomLIFX = BedroomLIFX,
CiteAs = requireEntity("entity", "cite-as"),
ClipboardText = requireEntity("entity", "clipboard-text"),
EmojiPicker = requireEntity("entity", "emoji-picker"),
FSVolume = requireEntity("entity", "fs-volume"),
GlyphPicker = requireEntity("entity", "glyph-picker"),
KaomojiPicker = requireEntity("entity", "kaomoji-picker"),
Keyboard = requireEntity("entity", "keyboard"),
NotificationCenter = requireEntity("entity", "notification-center"),
SmartPlug = requireEntity("entity", "tplink-smart-plug"),
Soundboard = requireEntity("entity", "soundboard"),
-- Add default Ki application entities that are to be remapped
FaceTime = defaultEntities.FaceTime,
TextEdit = defaultEntities.TextEdit,
-- Add default Ki application entities that have been configured
Safari = requireEntity("application", "safari"),
Spotify = requireEntity("application", "spotify"),
}
----------------------------------------------------------------------------------------------------
-- Register custom shortcuts for various modes
--
-- Register entity mode shortcuts
Mode {
name = "entity",
shortcuts = {
{ nil , "1" , entities["1Password"] },
{ nil , "a" , entities.Alacritty },
{ nil , "c" , entities.Fantastical },
{ nil , "e" , entities.MicrosoftExcel },
{ nil , "j" , entities.Java },
{ nil , "k" , entities.Keyboard },
{ nil , "l" , entities.BedroomLIFX },
{ nil , "o" , entities.Obsidian },
{ nil , "s" , entities.Arc },
{ nil , "v" , entities.VMWareFusion },
{ nil , "w" , entities.MicrosoftWord },
{ nil , "z" , entities.Zoom },
{ { "alt" } , "c" , entities.CiteAs },
{ { "alt" } , "p" , entities.SmartPlug },
{ { "alt", "cmd" } , "c" , entities.Cron },
{ { "alt", "cmd" } , "p" , entities.Plex },
{ { "alt", "cmd" } , "s" , entities.Signal },
{ { "cmd" } , "c" , entities.ClipboardText },
{ { "cmd" } , "e" , entities.EmojiPicker },
{ { "cmd" } , "g" , entities.GlyphPicker },
{ { "cmd" } , "k" , entities.KaomojiPicker },
{ { "cmd" } , "m" , entities.MEGASync },
{ { "cmd" } , "t" , entities.TextEdit },
{ { "cmd" } , "v" , entities.FSVolume },
{ { "ctrl" } , "n" , entities.NotificationCenter },
{ { "ctrl" } , "p" , entities.ProtonVPN },
{ { "ctrl" } , "s" , entities.ScriptEditor },
{ { "shift" } , "d" , entities.Discord },
{ { "shift" } , "f" , entities.Firefox },
{ { "shift" } , "g" , entities.Gitter },
{ { "shift" } , "h" , entities.Hammerspoon },
{ { "shift" } , "i" , entities.IINA },
{ { "shift" } , "l" , entities.LINE },
{ { "shift" } , "m" , entities.Messenger },
{ { "shift" } , "p" , entities.ParallelsDesktop },
{ { "shift" } , "t" , entities.iTerm },
{ { "shift" } , "v" , entities.VLC },
{ { "shift", "cmd" } , "f" , entities.FaceTime },
{ { "shift", "cmd" } , "l" , entities.LimeChat },
{ { "shift", "cmd" } , "m" , entities.MicrosoftOutlook },
{ { "shift", "cmd" } , "p" , entities.Postico },
{ { "shift", "cmd" } , "s" , entities.Slack },
{ { "shift", "cmd" } , "v" , entities.VisualStudioCode },
},
}
-- Register select mode shortcuts
Mode {
name = "select",
shortcuts = {
{ nil , "e" , entities.MicrosoftExcel , "Select a Microsoft Excel window" },
{ nil , "j" , entities.Java , "Select a Java app" },
{ nil , "s" , entities.Arc , "Select an Arc tab or window" },
{ nil , "w" , entities.MicrosoftWord , "Select a Microsoft Word window" },
{ nil , "v" , entities.VMWareFusion , "Select VMware Fusion window" },
{ { "cmd" } , "t" , entities.TextEdit , "Select a TextEdit window" },
{ { "cmd" } , "v" , entities.FSVolume , "Select a filesystem volume" },
{ { "ctrl" } , "s" , entities.ScriptEditor , "Select a Script Editor window" },
{ { "shift" } , "i" , entities.IINA , "Select an IINA window" },
{ { "shift" } , "p" , entities.TablePlus , "Select a Database Connection" },
{ { "shift" } , "t" , entities.iTerm , "Select an iTerm window" },
{ { "shift" } , "v" , entities.VLC , "Select a VLC window" },
{ { "shift", "cmd" } , "m" , entities.MicrosoftOutlook , "Select a Microsoft Outlook window" },
},
}
-- Register Website mode shortcuts
Mode {
name = "website",
shortcuts = {
{ nil , "a" , websites.Amazon },
{ nil , "b" , websites.BankOfAmerica },
{ nil , "c" , websites.Chase },
{ nil , "d" , websites.DuckDuckGo },
{ nil , "e" , websites.Etsy },
{ nil , "g" , websites.Google },
{ nil , "m" , websites.FacebookMessenger },
{ nil , "n" , websites.Netflix },
{ nil , "r" , websites.Reddit },
{ nil , "s" , websites.StackOverflow },
{ nil , "w" , websites.Wikipedia },
{ nil , "y" , websites.YouTube },
{ { "alt" } , "d" , websites.Dropbox },
{ { "shift", "cmd" } , "c" , websites.Crunchbase },
{ { "cmd" } , "a" , websites.APNews },
{ { "cmd" } , "b" , websites.BBC },
{ { "cmd" } , "h" , websites.Hammerspoon },
{ { "cmd" } , "n" , websites.NYTimes },
{ { "ctrl" } , "l" , websites.Lobsters },
{ { "ctrl" } , "m" , websites.MonarchMoney },
{ { "ctrl" } , "s" , websites.Synchrony },
{ { "ctrl" } , "u" , websites.Upgrade },
{ { "shift" } , "a" , websites.Airbnb },
{ { "shift" } , "c" , websites.CapitalOne },
{ { "shift" } , "g" , websites.Github },
{ { "shift", "cmd" } , "g" , websites.Glassdoor },
{ { "shift" } , "l" , websites.LearnXInYMinutes },
{ { "shift" } , "m" , websites.GoogleMaps },
{ { "shift" } , "n" , websites.NPM },
{ { "shift" } , "o" , websites.Oreilly },
{ { "shift" } , "t" , websites.TempMail },
{ { "shift" } , "y" , websites.Yelp },
{ { "shift" } , "z" , websites.ZeroTier },
{ { "shift", "cmd" } , "a" , websites.MyAnimeList },
{ { "shift", "cmd" } , "h" , websites.HammerspoonDocs },
{ { "shift", "cmd" } , "l" , websites.Letterboxd },
{ { "shift", "cmd" } , "n" , websites.NPR },
},
}
-- Register file mode shortcuts
Mode {
name = "file",
shortcuts = {
{ nil , "c" , files.Code },
{ { "alt" } , "d" , files.Dropbox },
{ { "shift" } , "t" , files.TV },
},
}
----------------------------------------------------------------------------------------------------
-- Register custom modes and their shortcuts
--
-- Register custom Ki modes
require("ki-modes/mouse-mode")
require("ki-modes/scroll-mode")
require("ki-modes/search-mode")
require("ki-modes/window-mode")
-- Register mode transitions between mouse and scroll mode
ModeTransitions {
{ "mouse", "scroll", { { "alt", "cmd" }, "s" } },
{ "scroll", "mouse", { { "cmd" }, "m" } },
}
-- Register shortcuts for the custom search mode
Mode {
name = "search",
shortcuts = {
{ nil , "a" , websites.Amazon },
{ nil , "d" , websites.DuckDuckGo },
{ nil , "e" , websites.Etsy },
{ nil , "g" , websites.Google },
{ nil , "l" , websites.LinkedIn },
{ nil , "n" , websites.Netflix },
{ nil , "r" , websites.Reddit },
{ nil , "s" , websites.StackOverflow },
{ nil , "w" , websites.Wikipedia },
{ nil , "y" , websites.YouTube },
{ { "cmd" } , "b" , websites.BBC },
{ { "cmd" } , "n" , websites.NYTimes },
{ { "shift" } , "g" , websites.Github },
{ { "shift", "cmd" } , "c" , websites.Crunchbase },
{ { "shift", "cmd" } , "g" , websites.Glassdoor },
{ { "shift", "cmd" } , "l" , websites.Letterboxd },
{ { "shift" } , "m" , websites.GoogleMaps },
{ { "shift" } , "n" , websites.NPM },
{ { "shift" } , "y" , websites.Yelp },
{ { "shift" } , "z" , websites.ZeroTier },
{ { "shift", "cmd" } , "a" , websites.MyAnimeList },
{ { "shift", "cmd" } , "n" , websites.NPR },
},
}
----------------------------------------------------------------------------------------------------
-- Save custom entities to reference in local configs
--
Ki.customEntities = entities
Ki.customFiles = files
Ki.customWebsites = websites