-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdot_khdrc
326 lines (257 loc) · 13.7 KB
/
dot_khdrc
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
# sample config for khd
# NOTE(koekeishiya): A bind is written in the form:
# <keysym> [!] [<app list>] [->] : <command>
# where
# <keysym> = mode + mod + ... + mod - literal
#
# <keysym> = mode + mod + ... + mod - keycode
# keycode must have 0x prefix
#
# <keysym> = mode + mod + ... + mod - button#
# replace '#' with mouse-button id; id >= 3
#
# modifier only binding
# <keysym> = mode + mod + ... + mod
#
# literal only binding
# <keysym> = - literal
#
# keycode only binding
# <keysym> = - keycode
#
# [<app,
# app, = optional list '[app1, ..., appN]' of applications
# app>] that this bind will be activated for. if the
# focused application is not contained in this list,
# the associated command will not be triggered, and
# the keypress will be passed through as normal.
#
# [!] = optional operator '!' negates the behaviour when a
# list of applications is given. this marks the bind
# as 'Hotkey_Exclude', causing the bind to not work
# when the focused application is in the given list.
#
# [->] = optional operator '->' that marks this bind as
# 'passthrough'. this causes the key to be passed
# through to the system, instead of being consumed.
#
# <command> = command is executed through '$SHELL -c' and
# follows valid shell syntax. if the $SHELL environment
# variable is not set, it will default to '/bin/bash'.
# when bash is used, the ';' delimeter can be specified
# to chain commands.
#
# to allow a command to extend into multiple lines,
# prepend '\' at the end of the previous line.
#
# an EOL character signifies the end of the bind.
# NOTE(koekeishiya) Example of passthrough
# cmd - m -> : echo "alert and minimize window" | alerter -title Test passthrough -timeout 2
# NOTE(koekeishiya) Example of app list
# alt - e [
# iTerm2,
# Terminal,
# HyperTerm
# ]
# : echo "so this is how deep the rabbit hole goes.." |\
# alerter -title Test passthrough -timeout 2
# NOTE(koekeishiya) Example of negated app list
# alt - e [
# iTerm2,
# Terminal,
# HyperTerm
# ] !
# : echo "blue pill, i choose you!" |\
# alerter -title Test passthrough -timeout 2
# NOTE(koekeishiya) Modifier only binding
# left shift -> ( right shift -> )
# left cmd -> { right cmd -> }
# khd mod_trigger_timeout 0.1
# lshift : khd -p "shift - 8"
# rshift : khd -p "shift - 9"
# lcmd : khd -p "shift + alt - 8"
# rcmd : khd -p "shift + alt - 9"
# NOTE(koekeishiya) Bind mouse-buttons
# - button3 : khd -w "mouse-button 3 pressed"
# - button4 : khd -w "mouse-button 4 pressed"
# TODO(koekeishiya): possibly allow combined syntax such as
# [switcher,ytd] + ctrl - f : khd -e "mode activate default"
# vi-mode for non-terminal applications
# remap left-control h/j/k/l -> arrow keys
#lctrl - h ![HyperTerm,Terminal,iTerm2] : khd -p "- left"
# lctrl - j ![HyperTerm,Terminal,iTerm2] : khd -p "- down"
# lctrl - k ![HyperTerm,Terminal,iTerm2] : khd -p "- up"
# lctrl - l ![HyperTerm,Terminal,iTerm2] : khd -p "- right"
# shift + lctrl - h ![HyperTerm,Terminal,iTerm2] : khd -p "shift - left"
# shift + lctrl - j ![HyperTerm,Terminal,iTerm2] : khd -p "shift - down"
# shift + lctrl - k ![HyperTerm,Terminal,iTerm2] : khd -p "shift - up"
# shift + lctrl - l ![HyperTerm,Terminal,iTerm2] : khd -p "shift - right"
# # remap left-control 0 / 4 -> start / end of line
# lctrl - 0 ![HyperTerm,Terminal,iTerm2] : khd -p "cmd - left"
# lctrl - 4 ![HyperTerm,Terminal,iTerm2] : khd -p "cmd - right"
# # remap left-control g / G -> start / end of text
# lctrl - g ![HyperTerm,Terminal,iTerm2] : khd -p "cmd - up"
# lctrl + shift - g ![HyperTerm,Terminal,iTerm2] : khd -p "cmd - down"
# shift + lctrl - 0 ![HyperTerm,Terminal,iTerm2] : khd -p "shift + cmd - left"
# shift + lctrl - 4 ![HyperTerm,Terminal,iTerm2] : khd -p "shift + cmd - right"
# # remap left-control b / e -> start / end of word
# lctrl - b ![HyperTerm,Terminal,iTerm2] : khd -p "alt - left"
# lctrl - e ![HyperTerm,Terminal,iTerm2] : khd -p "alt - right"
# shift + lctrl - b ![HyperTerm,Terminal,iTerm2] : khd -p "shift + alt - left"
# shift + lctrl - e ![HyperTerm,Terminal,iTerm2] : khd -p "shift + alt - right"
# remap left-control x -> forward delete
#lctrl - x ![HyperTerm,Terminal,iTerm2] : khd -p "- delete"
# enable kwm compatibility mode
# khd kwm on
# suppress unregistered keybinds outside default mode
# enabled by default! must be explicitly set to 'off'
# khd void_unlisted_bind off
# set border color for different modes
khd mode default on_enter kwmc config border focused color 0xddd5c4a1
khd mode mode on_enter kwmc config border focused color 0xddd75f5f
khd mode switcher on_enter kwmc config border focused color 0xddbdd322
khd mode swap on_enter kwmc config border focused color 0xdd458588
khd mode tree on_enter kwmc config border focused color 0xddfabd2f
khd mode space on_enter kwmc config border focused color 0xddb16286
khd mode info on_enter kwmc config border focused color 0xddcd950c
khd mode launcher on_enter kwmc config border focused color 0xFF0000AA
# toggle between modes
ctrl - escape : khd -e "mode activate mode"
ctrl - q : khd -e "mode activate launcher"
launcher - q : khd -e "mode activate opener"
launcher - escape : khd -e "mode activate default"
opener - escape : khd -e "mode activate default"
mode - escape : khd -e "mode activate default"
switcher - escape : khd -e "mode activate default"
swap - escape : khd -e "mode activate default"
space - escape : khd -e "mode activate default"
tree - escape : khd -e "mode activate default"
info - escape : khd -e "mode activate default"
launcher - return : khd -e "mode activate default"
opener- return : khd -e "mode activate default"
mode - return : khd -e "mode activate default"
switcher - return : khd -e "mode activate default"
swap - return : khd -e "mode activate default"
space - return : khd -e "mode activate default"
tree - return : khd -e "mode activate default"
info - return : khd -e "mode activate default"
mode - w : khd -e "mode activate switcher"
mode - a : khd -e "mode activate swap"
mode - s : khd -e "mode activate space"
mode - d : khd -e "mode activate tree"
mode - q : khd -e "mode activate info"
# switcher mode
switcher - r : khd -e "reload" # reload config
switcher - return : open -na /Applications/HyperTerm.app;\
khd -e "mode activate default"
switcher - h : kwmc window -f west
switcher - l : kwmc window -f east
switcher - j : kwmc window -f south
switcher - k : kwmc window -f north
switcher - n : kwmc window -fm prev
switcher - m : kwmc window -fm next
switcher - 1 : kwmc space -fExperimental 1
switcher - 2 : kwmc space -fExperimental 2
switcher - 3 : kwmc space -fExperimental 3
switcher - 4 : kwmc space -fExperimental 4
switcher - 5 : kwmc space -fExperimental 5
switcher - 6 : kwmc space -fExperimental 6
switcher - z : kwmc space -fExperimental left
switcher - c : kwmc space -fExperimental righ
switcher - f : kwmc space -fExperimental previous
switcher + shift - z : kwmc window -m space left;\
kwmc space -fExperimental left
switcher + shift - c : kwmc window -m space right;\
kwmc space -fExperimental right
switcher + shift - 1 : kwmc display -f 0
switcher + shift - 2 : kwmc display -f 1
switcher + shift - 3 : kwmc display -f 2
# swap mode
swap - h : kwmc window -s west
swap - j : kwmc window -s south
swap - k : kwmc window -s north
swap - l : kwmc window -s east
swap - m : kwmc window -s mark
swap + shift - k : kwmc window -m north
swap + shift - l : kwmc window -m east
swap + shift - j : kwmc window -m south
swap + shift - h : kwmc window -m west
swap + shift - m : kwmc window -m mark
swap - 1 : kwmc window -m space 1
swap - 2 : kwmc window -m space 2
swap - 3 : kwmc window -m space 3
swap - 4 : kwmc window -m space 4
swap - 5 : kwmc window -m space 5
swap - z : kwmc window -m space left
swap - c : kwmc window -m space right
swap + shift - 1 : kwmc window -m display 0
swap + shift - 2 : kwmc window -m display 1
swap + shift - 3 : kwmc window -m display 2
# space mode
space - a : kwmc space -t bsp
space - s : kwmc space -t monocle
space - d : kwmc space -t float
space - x : kwmc space -g increase horizontal
space - y : kwmc space -g increase vertical
space + shift - x : kwmc space -g decrease horizontal
space + shift - y : kwmc space -g decrease vertical
space - left : kwmc space -p increase left
space - right : kwmc space -p increase right
space - up : kwmc space -p increase top
space - down : kwmc space -p increase bottom
space - p : kwmc space -p increase all
space + shift - left : kwmc space -p decrease left
space + shift - right : kwmc space -p decrease right
space + shift - up : kwmc space -p decrease top
space + shift - down : kwmc space -p decrease bottom
space + shift - p : kwmc space -p decrease all
# tree mode
tree - f : kwmc window -z fullscreen
tree - d : kwmc window -z parent
tree - w : kwmc window -t focused
tree - r : kwmc tree rotate 90
tree - s : kwmc window -c split - mode toggle;\
khd -e "mode activate default"
tree - c : kwmc window -c type toggle;\
khd -e "mode activate default"
tree - h : kwmc window -c expand 0.05 west
tree - j : kwmc window -c expand 0.05 south
tree - k : kwmc window -c expand 0.05 north
tree - l : kwmc window -c expand 0.05 east
tree + shift - h : kwmc window -c reduce 0.05 west
tree + shift - j : kwmc window -c reduce 0.05 south
tree + shift - k : kwmc window -c reduce 0.05 north
tree + shift - l : kwmc window -c reduce 0.05 east
tree - p : kwmc tree -pseudo create
tree + shift - p : kwmc tree -pseudo destroy
tree - o : kwmc window -s prev
tree + shift - o : kwmc window -s next
# launcher mode
launcher - e : /usr/local/bin/emacsclient -c -a /usr/local/bin/emacs &;\
khd -e "mode activate default"
launcher - c : capture.sh &;\
khd -e "mode activate default"
launcher + shift - s : savior.sh &;\
khd -e "mode activate default"
launcher - w : open -a "palemoon"; khd -e "mode activate default"
launcher - a : open -a "anki"; khd -e "mode activate default"
launcher - t : open -a "iterm"; khd -e "mode activate default"
launcher - k : open -a "keepassxc"; khd -e "mode activate default"
launcher - m : open -a "macvim"; khd -e "mode activate default"
launcher - f : open -a "finder"; khd -e "mode activate default"
launcher - p : open "x-apple.systempreferences:"; khd -e "mode activate default"
launcher - g : sudo toggleProxy.sh; khd -e "mode activate default"
launcher - v : pwgen -cny -C 12 -N 1 | xargs -I _ printf %s _ | pbcopy; khd -e "mode activate default"
launcher - n : open -a /Applications/FirefoxNightly.app --args -p nightly --no-remote; khd -e "mode activate default"
# default
cmd + alt + ctrl - m : kwmc window -mk focused
cmd + alt + ctrl - h : kwmc window -mk west wrap
cmd + alt + ctrl - l : kwmc window -mk east wrap
cmd + alt + ctrl - j : kwmc window -mk south wrap
cmd + alt + ctrl - k : kwmc window -mk north wrap
cmd - 7 : khd -w "\\"
cmd - 8 : khd -w "{"
cmd - 9 : khd -w "}"
# opener mode
opener - i : orgAddIdea.sh; khd -e "mode activate default"
opener - t : orgAddTodo.sh; khd -e "mode activate default"