-
Notifications
You must be signed in to change notification settings - Fork 1
/
skhdrc
180 lines (151 loc) · 9.27 KB
/
skhdrc
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
# linux keyboard has hyper, not fn
# mac keyboard has fn, not hyper
# inside [], the following means
# * : command key is bound in all apps
# "terminal" ~ key is unbound in terminal (without the : command separator)
cmd + shift - return [
"emacs" : ~/.config/dotfiles/new-tab.sh
"slack" : ~/.config/dotfiles/new-tab.sh
"iterm2" : ~/.config/dotfiles/new-tab.sh
"finder" : ~/.config/dotfiles/new-tab.sh
"firefox" : ~/.config/dotfiles/new-tab.sh
"alacritty" : ~/.config/dotfiles/new-tab.sh
"google chrome" : ~/.config/dotfiles/new-tab.sh
"intellij idea" ~
]
# cmd + shift + alt - return : open -na Google\ Chrome --args --profile-directory=Profile\ 2 "chrome://newtab" # --new-window
cmd + alt + ctrl - e : emacsclient --eval "(emacs-everywhere)"
alt - e [
"emacs" ~ # end of sentence
* : open -a Emacs
]
alt - t [
"alacritty" ~ # transpose words
"intellij idea" ~ # conflicts with show type on extract variable
* : open -a Alacritty
]
alt - i : open -a Firefox
alt - c : open -a IntelliJ\ IDEA
alt - o : open -a Microsoft\ Outlook
alt - s : open -a Slack
cmd - return [
# "emacs" : # dont catch this, s-return is bound in emacs
"finder" : folder=$(osascript -e 'tell application "Finder" to return (POSIX path of (folder of the front window as alias))') ; emacsclient --eval "(let ((default-directory \"$folder\")) (+vterm/here t))" ; open -a Emacs;
"slack" : emacsclient --eval '(let ((default-directory (t/read-file "~/.cur"))) (+vterm/here t))'; open -a Emacs;
"firefox" : emacsclient --eval '(let ((default-directory (t/read-file "~/.cur"))) (+vterm/here t))'; open -a Emacs;
"zoom.us" : emacsclient --eval '(let ((default-directory (t/read-file "~/.cur"))) (+vterm/here t))'; open -a Emacs;
"alacritty" : emacsclient --eval '(let ((default-directory (t/read-file "~/.cur"))) (+vterm/here t))'; open -a Emacs;
"google chrome" : emacsclient --eval '(let ((default-directory (t/read-file "~/.cur"))) (+vterm/here t))'; open -a Emacs;
# conflicts with "complete brackets at end of line"
# "intellij idea" : emacsclient --eval '(let ((default-directory (t/read-file "~/.cur"))) (+vterm/here t))'; osascript -e 'tell application "Emacs" to activate';
"iterm2" : osascript ~/bin/iterm-new-tab.applescript
]
cmd + ctrl - return : open -a Alacritty
cmd + ctrl + shift - return : open -na Alacritty
cmd + shift - h : open -a Finder -- ~/
cmd + shift - w : open -a Finder -- ~/Downloads
# reload keybindings
alt + shift - c : cd && skhd -r
# move window focus
# https://github.com/koekeishiya/yabai/discussions/1326
# https://github.com/koekeishiya/yabai/discussions/1381
alt - h : ~/.config/dotfiles/yabai/yabai-left.sh
alt - l : ~/.config/dotfiles/yabai/yabai-right.sh
alt - k : yabai -m window --focus north || yabai -m display --focus north
alt - j : yabai -m window --focus south || yabai -m display --focus south
# swap location with window in direction
alt + shift - h : yabai -m window --warp west || $(WIN_ID=$(yabai -m query --windows --window | jq '.id') && yabai -m window --display west && yabai -m window --focus $WIN_ID);
alt + shift - l : yabai -m window --warp east || $(WIN_ID=$(yabai -m query --windows --window | jq '.id') && yabai -m window --display east && yabai -m window --focus $WIN_ID);
alt + shift - k : yabai -m window --warp north || $(WIN_ID=$(yabai -m query --windows --window | jq '.id') && yabai -m window --display north && yabai -m window --focus $WIN_ID);
alt + shift - j : yabai -m window --warp south || $(WIN_ID=$(yabai -m query --windows --window | jq '.id') && yabai -m window --display south && yabai -m window --focus $WIN_ID);
alt + shift - 0 : yabai -m space --balance
# rotations
alt + shift - r : yabai -m space --rotate 270
alt + shift - y : yabai -m space --mirror y-axis
alt + shift - x : yabai -m space --mirror x-axis
# float and center on screen
alt + shift - f : yabai -m window --toggle float;\
yabai -m window --grid 11:11:3:1:6:8
# Float and column in center of screen
alt + shift - u : yabai -m window --toggle float;\
yabai -m window --grid 11:11:2:0:7:11
# fullscreen
alt + shift - m : yabai -m window --toggle zoom-fullscreen
# toggle fill parent column
alt + shift - p : yabai -m window --toggle zoom-parent
# change split direction
alt + shift - s : yabai -m window --toggle split
alt + shift - g : yabai -m window --insert east
alt + shift - v : yabai -m window --insert south
# support throwing floated windows with limited size to the sides
fn - h : yabai -m window --grid 11:11:0:0:5:11
fn - l : yabai -m window --grid 11:11:6:0:5:11
# gap mode
:: gap @ : yabai -m window --toggle border
hyper - g ; gap
fn - g ; gap
gap < z : yabai -m space --padding abs:0:0:0:0;\
yabai -m space --gap abs:0
gap < s : yabai -m space --padding abs:10:10:10:10;\
yabai -m space --gap abs:10
gap < m : yabai -m space --padding abs:20:20:20:20;\
yabai -m space --gap abs:20
gap < l : yabai -m space --padding abs:50:50:50:50;\
yabai -m space --gap abs:50
gap < h : yabai -m space --padding abs:100:100:100:100;\
yabai -m space --gap abs:100
gap < 0x1B : yabai -m space --gap rel:20;\
yabai -m space --padding rel:+20:+20:+20:+20
gap < 0x2C : yabai -m space --gap rel:-20;\
yabai -m space --padding rel:-20:-20:-20:-20
gap < escape ; default
gap < return ; default
# resize windows
ctrl + cmd - right : yabai -m window --resize right:50:0
ctrl + cmd - left : yabai -m window --resize right:-50:0
ctrl + cmd - up : yabai -m window --resize bottom:0:-50
ctrl + cmd - down : yabai -m window --resize bottom:0:50
# move windows
ctrl + shift + cmd - right : yabai -m window --move rel:+50:0
ctrl + shift + cmd - left : yabai -m window --move rel:-50:0
ctrl + shift + cmd - up : yabai -m window --move rel:0:-50
ctrl + shift + cmd - down : yabai -m window --move rel:0:50
# move to other display, cycles monitors
ctrl + alt + cmd - d: WIN_ID=$(yabai -m query --windows --window | jq '.id') && (yabai -m window --display next || yabai -m window --display first) && yabai -m window --focus $WIN_ID
ctrl + alt + cmd - p: WIN_ID=$(yabai -m query --windows --window | jq '.id') && (yabai -m window --display next || yabai -m window --display first) && yabai -m window --focus $WIN_ID
ctrl + alt + cmd + shift - p: WIN_ID=$(yabai -m query --windows --window | jq '.id') && (yabai -m window --display prev || yabai -m window --display last) && yabai -m window --focus $WIN_ID
# move windows to screen corners
ctrl + alt + cmd - i : yabai -m window --grid 8:8:0:0:4:4
ctrl + alt + cmd - l : yabai -m window --grid 8:8:4:4:4:4
ctrl + alt + cmd - k : yabai -m window --grid 8:8:0:4:4:4
ctrl + alt + cmd - o : yabai -m window --grid 8:8:4:0:4:4
# move windows to screen edges
ctrl + alt + cmd - up : yabai -m window --grid 2:2:0:0:2:1
ctrl + alt + cmd - down : yabai -m window --grid 1:1:0:0:0:0
ctrl + alt + cmd - left : yabai -m window --grid 1:2:0:0:1:1
ctrl + alt + cmd - right : yabai -m window --grid 1:2:1:0:1:1
# move windows to screen outer left and right
shift + ctrl + alt + cmd - h : yabai -m window --grid 12:12:0:0:3:12
shift + ctrl + alt + cmd - l : yabai -m window --grid 12:12:9:0:3:12
# move windows across spaces without the scripting addition, and focus display with space
alt - 1: skhd -k "shift + ctrl - 1"; yabai -m display --focus $(yabai -m query --spaces --space 1 | jq .display)
alt - 2: skhd -k "shift + ctrl - 2"; yabai -m display --focus $(yabai -m query --spaces --space 2 | jq .display)
alt - 3: skhd -k "shift + ctrl - 3"; yabai -m display --focus $(yabai -m query --spaces --space 3 | jq .display)
alt - 4: skhd -k "shift + ctrl - 4"; yabai -m display --focus $(yabai -m query --spaces --space 4 | jq .display)
alt - 5: skhd -k "shift + ctrl - 5"; yabai -m display --focus $(yabai -m query --spaces --space 5 | jq .display)
alt - 6: skhd -k "shift + ctrl - 6"; yabai -m display --focus $(yabai -m query --spaces --space 6 | jq .display)
# 7 conflicts with | on a norwegian keyboard
shift + alt - p : yabai -m window --space prev;
shift + alt - n : yabai -m window --space next;
alt + shift - 1: yabai -m window --space 1; skhd -k "shift + ctrl - 1"
alt + shift - 2: yabai -m window --space 2; skhd -k "shift + ctrl - 2"
alt + shift - 3: yabai -m window --space 3; skhd -k "shift + ctrl - 3"
alt + shift - 4: yabai -m window --space 4; skhd -k "shift + ctrl - 4"
alt + shift - 5: yabai -m window --space 5; skhd -k "shift + ctrl - 5"
alt + shift - 6: yabai -m window --space 6; skhd -k "shift + ctrl - 6"
# trello url
# not alt t as it conflicts with transpose
alt + shift - t : osascript -l JavaScript -e ' [].slice.call(((app) => (app && app.windows) || [])(Application("Google Chrome"))) .map((w) => [w, [].slice .call(w.tabs) .map((t, idx) => [idx + 1, t.url()]) .filter(([index, url]) => url.includes("trello.com/c/")) .map(([index, url]) => index),]) .forEach(([w, indices]) => indices.forEach((index) => w.activeTabIndex.set(index)));' && osascript -e 'tell application "Google Chrome" to activate'
fn - m: yabai -m window --space 5; yabai -m display --focus 5; yabai -m window --grid 1:1:1:1:0:0; yabai -m window --resize abs:1000:500;
fn - p: yabai -m window --space 1; yabai -m display --focus 1; yabai -m window --toggle zoom-fullscreen;
hyper - p: yabai -m window --space 1; yabai -m display --focus 1; yabai -m window --toggle zoom-fullscreen;