forked from litoj/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path30_binds.swayconf
375 lines (351 loc) · 11.7 KB
/
30_binds.swayconf
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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
#-----------------+
# Gap bindingings |
#-----------------+
bindsym {
$Mod+g gaps inner current plus 5
$Mod+Shift+g gaps inner current minus 5
$Mod+$Alt+g gaps outer current plus 5
$Mod+$Alt+Shift+g gaps outer current minus 5
$Mod+Shift+t gaps inner current toggle $gaps
$Mod+$Alt+t border toggle $border
$Mod+$Alt+Shift+t exec $signal theme toggle
$Mod+u exec $nextbg
$Mod+Ctrl+u exec swayimg "$(cat /tmp/my/bg)" "$(sed 's,/[^/]*$,,' /tmp/my/bg)"
#---------------+
# App selection |
#---------------+
# app launcher/picker
$Mod+r exec rofi -show drun
# copy menu
# $Mod+p exec copyq menu
# quick app starter
$Mod+Return exec xterm
}
set $Msg '[T]hunderbird [D]iscord [S]lack'
set $IDE '[I]dea [N]etbeans [A]ndroid [E]Architect [D]ataGrip [R]ider'
set $lof ~/.config/sway/lof
bindsym --to-code {
$Mod+1 exec $lof firefox '[app_id=firefox]'
$Mod+2 exec $lof 'xterm nvim && sleep 1 && swaymsg mark nvim' '[con_mark=nvim]'
$Mod+$Alt+2 exec $lof 'xterm nvim -i ~/Documents/work/session.shada && sleep 1 \
&& swaymsg mark work' '[con_mark=work]'
$Mod+$Alt+Shift+2 exec $lof 'xterm nvim -i ~/Documents/school/PG/SP/session.shada && sleep 1 \
&& swaymsg mark dbs' '[con_mark=dbs]'
$Mod+3 exec xterm
$Mod+4 exec $lof 'swaymsg mode \$Msg' '[workspace="$wMsg"]'
$Mod+5 exec $lof 'swaymsg mode \$IDE' '[workspace="$wCode"]'
$Mod+7 exec $lof gimp '[class=Gimp|mpv]'
$Mod+$Alt+9 exec $lof prismlauncher '[app_id=null title=^(Minecraft|Prism Launcher).*]'
$Mod+9 exec $lof 'prismlauncher --launch Vanilla' '[title=^(Minecraft|Prism Launcher).*]'
}
mode $Msg {
bindsym {
t mode default, exec $lof thunderbird '[app_id=thunderbird]'
d mode default, exec $lof ripcord '[class=Ripcord]'
s mode default, exec $lof 'slack --ozone-platform=wayland \
--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer' '[class=Slack]'
Escape mode default
}
}
mode $IDE {
bindsym {
i mode default, exec $lof idea '[class=jetbrains-idea-ce]'
d mode default, exec $lof datagrip '[class=jetbrains-datagrip]'
r mode default, exec $lof rider '[class=jetbrains-rider]'
n mode default, exec $lof netbeans '[class=NetBeans]'
a mode default, exec $lof 'JAVA_HOME=/opt/android-studio/jbr android-studio' \
'[class=jetbrains-studio]'
e mode default, exec $lof 'gtk-launch ea' '[class=ea.exe]'
q mode default
Escape mode default
}
}
bindsym {
$Mod+e exec xterm ranger
$Mod+$Alt+e exec pcmanfm
# managing/control
Ctrl+Shift+Escape exec xterm htop
#------------------+
# Win manipulation |
#------------------+
## Termination
# kill focused window
# $Mod+q kill
Shift+KP_Subtract kill
# force kill window on select
$Mod+$Alt+q exec killall -9 $(pgrep -u $USER -l | \
sed 's/^[0-9]* //' | sort | rofi -dmenu -i -p "force kill")
$Alt+F4 exec kill -9 $(swaymsg -t get_tree | jq '.. | \
(.nodes? // empty)[] | select(.focused==true).pid')
## Focus
$Mod+space focus mode_toggle
KP_Begin focus mode_toggle
}
bindsym --to-code {
# Swayfx
# $Mod+0 dim_inactive 0
# $Mod+Shift+0 dim_inactive 0.15
# change tiling layer
$Mod+grave focus parent
$Mod+Shift+grave focus child
## Layout change
$Mod+f fullscreen toggle
F11 fullscreen toggle
Shift+KP_Begin fullscreen toggle
# container types
$Mod+Ctrl+space sticky toggle
$Mod+c split toggle
$Mod+z layout toggle splith splitv tabbed
# tiling/floating managing
$Mod+Shift+space floating toggle, sticky toggle, border pixel $border
# scratchpad
$Mod+Shift+minus move scratchpad
$Mod+minus scratchpad show
}
set $floatpos ~/.config/sway/floatpos
bindsym {
#--------+
# Arrows |
#--------+
# floating mode, with tilling mode compatibility
$Mod+Left exec $floatpos l
$Mod+Down exec $floatpos d
$Mod+Up exec $floatpos u
$Mod+Right exec $floatpos r
# snap to side or focus in tiling mode
$Mod+Shift+Left exec $floatpos l focusable
$Mod+Shift+Down exec $floatpos d focusable
$Mod+Shift+Up exec $floatpos u focusable
$Mod+Shift+Right exec $floatpos r focusable
# focus workspace
$Mod+Ctrl+Left workspace prev
$Mod+Ctrl+Right workspace next
# focus output
$Mod+$Alt+Left focus output left
$Mod+$Alt+Down focus output down
$Mod+$Alt+Up focus output up
$Mod+$Alt+Right focus output right
#--------+
# Keypad |
#--------+
# focus
KP_Left focus left
KP_Down focus down
KP_Up focus up
KP_Right focus right
# move
Shift+KP_Left exec $floatpos l
Shift+KP_Down exec $floatpos d
Shift+KP_Up exec $floatpos u
Shift+KP_Right exec $floatpos r
# snap to side or focus in tiling mode
Ctrl+KP_Left exec $floatpos l focusable
Ctrl+KP_Down exec $floatpos d focusable
Ctrl+KP_Up exec $floatpos u focusable
Ctrl+KP_Right exec $floatpos r focusable
# focus workspace
KP_Add workspace back_and_forth
KP_Home workspace next
KP_End workspace prev
#-----------+
# Left Hand |
#-----------+
# focus
$Mod+a focus left
$Mod+s focus down
$Mod+w focus up
$Mod+d focus right
# move
$Mod+Shift+a move left
$Mod+Shift+s move down
$Mod+Shift+w move up
$Mod+Shift+d move right
$Mod+Shift+c exec $floatpos c
# resize
$Mod+$Alt+a resize shrink width 4
$Mod+$Alt+s resize grow height 4
$Mod+$Alt+w resize shrink height 4
$Mod+$Alt+d resize grow width 4
# focus workspace
$Mod+Ctrl+s workspace prev
$Mod+Ctrl+w workspace next
$Mod+$Alt+Tab workspace next
$Mod+Shift+Tab workspace prev
$Mod+Tab workspace back_and_forth
# move container to workspace
$Mod+Ctrl+a move workspace prev, workspace prev
$Mod+Ctrl+d move workspace next, workspace next
$Mod+Ctrl+f move workspace back_and_forth, workspace back_and_forth
# both hands
$Mod+comma workspace prev
$Mod+period workspace next
}
# quick mark
bindsym --to-code {
$Mod+Ctrl+1 [con_mark=1] focus; mark 1
$Mod+Ctrl+2 [con_mark=2] focus; mark 2
$Mod+Ctrl+3 [con_mark=3] focus; mark 3
$Mod+Ctrl+4 [con_mark=4] focus; mark 4
$Mod+Ctrl+5 [con_mark=5] focus; mark 5
$Mod+Ctrl+6 [con_mark=6] focus; mark 6
$Mod+Ctrl+7 [con_mark=7] focus; mark 7
$Mod+Ctrl+8 [con_mark=8] focus; mark 8
$Mod+Ctrl+9 [con_mark=9] focus; mark 9
$Mod+Ctrl+0 [con_id=__focused__] unmark
}
# remove marks
bindsym {
$Mod+Ctrl+q unmark
#------------+
# Workspaces |
#------------+
# switch to
$Mod+F1 workspace $w1
$Mod+F2 workspace $w2
$Mod+F3 workspace $w3
$Mod+F4 workspace $w4
$Mod+F5 workspace $w5
$Mod+F6 workspace $w6
$Mod+F7 workspace $w7
$Mod+F8 workspace $w8
$Mod+F9 workspace $w9
}
# move focused container to
bindsym --to-code {
$Mod+Shift+1 sticky off, move workspace $w1, workspace $w1
$Mod+Shift+2 sticky off, move workspace $w2, workspace $w2
$Mod+Shift+3 sticky off, move workspace $w3, workspace $w3
$Mod+Shift+4 sticky off, move workspace $w4, workspace $w4
$Mod+Shift+5 sticky off, move workspace $w5, workspace $w5
$Mod+Shift+6 sticky off, move workspace $w6, workspace $w6
$Mod+Shift+7 sticky off, move workspace $w7, workspace $w7
$Mod+Shift+8 sticky off, move workspace $w8, workspace $w8
$Mod+Shift+9 sticky off, move workspace $w9, workspace $w9
}
#--------------+
# System setts |
#--------------+
set $dpmsOff pkill -USR1 swayidle
set $Exit "C: D: Q: S: H: P: R: Esc:"
bindsym {
$Mod+o bar mode toggle
XF86Launch4 exec cpupower-gui
Shift+XF86Launch4 exec f=$(cat /sys/firmware/acpi/platform_profile) && notify-send \
-t 1000 $([[ $f = *b* ]] && echo '-u low' || ([[ $f = *m* ]] && echo '-u critical')) $f
XF86PowerOff exec ~/.config/sway/lidSwitch toggle
$Mod+x mode $Exit
KP_Insert nop
}
bindsym --release {
XF86Display exec $dpmsOff
KP_Insert exec $dpmsOff
Shift+KP_Insert output $d1 toggle
}
mode $Exit {
bindsym {
c mode default, reload
e mode default, exec $signal cpu Powersave
a mode default, exec $signal cpu Auto
w mode default, exec $signal cpu Schedutil
t mode default, exec $signal cpu Test
Shift+E mode default, exec xterm sudo bash -c 'echo low-power > /sys/firmware/acpi/platform_profile'
Shift+A mode default, exec xterm sudo bash -c 'echo balanced > /sys/firmware/acpi/platform_profile'
Shift+P mode default, exec xterm sudo bash -c 'echo performance > /sys/firmware/acpi/platform_profile'
--release d mode default, exec $dpmsOff
--release Shift+d mode default, output $d1 toggle
--release $Alt+d mode default, exec $lid mode
q exit
s mode default, exec $lid sleep
h mode default, exec $([[ $(swapon --show=NAME) ]] || sudo swapon /swapfile) &&\
systemctl hibernate && sleep 60 && sudo swapoff /swapfile
p exit, exec $nextbg save; exec systemctl poweroff
r exit, exec reboot
Shift+w mode default; exec xterm sudo bash -c 'efibootmgr -n 0001 && reboot'
b mode default, exec xterm sudo bash -c \
'f=/sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode && echo $((($(cat \
$f)+1)%2)) > $f && (($(cat $f)==0)) && echo Full Charge || echo Conservation mode && sleep 1'
Escape mode default
}
}
#-----------------+
# Extra functions |
#-----------------+
set $mpv playerctl --player=mpv
set $info $mpv metadata --format
bindsym {
# Screenshot
# my pc has PrintScreen as Fn+s
Print exec grim - | wl-copy -t image/png
$Mod+Print exec grim -t jpeg "Pictures/scrshot/$(date +%y-%m-%d_%H-%M-%S).jpg"
Shift+Print exec swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?)\
| .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp -d -c ad30a8 -s ad30a822\
-b 00000000 -B 55991522 | grim -c -g - - | wl-copy -t image/png
Ctrl+Print exec imv -n "$(ls -t Pictures/scrshot|head -n1)" Pictures/scrshot
# Keyboard layout toggle, manual
$Mod+n exec $signal kb
$Alt+Escape exec $signal kb
# Change gamma, "redshift" manually - n for night
$Mod+$Alt+n exec wlsunset -l 50 -L 14.5 &
$Mod+Shift+n exec killall wlsunset
# Rotating screen
$Alt+Ctrl+Left output $d1 transform 270
$Alt+Ctrl+Right output $d1 transform 90
$Alt+Ctrl+Up output $d1 transform normal
$Alt+Ctrl+Down output $d1 transform 180
# Brightness
$Mod+b exec $signal light ^
$Mod+Shift+b exec $signal light v
XF86MonBrightnessUp exec $signal light ^
XF86MonBrightnessDown exec $signal light v
KP_Prior exec $signal light ^
KP_Next exec $signal light v
Shift+KP_Prior exec $signal light + 3
Shift+KP_Next exec $signal light - 2
# Audio / Volume
$Mod+$Alt+Shift+v exec $signal wp
$Mod+v exec $signal vol 5%+
$Mod+Shift+v exec $signal vol 5%-
$Mod+$Alt+v exec $signal vol toggle
$Mod+Ctrl+v exec $signal mic toggle
XF86AudioRaiseVolume exec $signal vol 5%+
XF86AudioLowerVolume exec $signal vol 5%-
Shift+XF86AudioRaiseVolume exec $signal mic 2%+
Shift+XF86AudioLowerVolume exec $signal mic 2%-
XF86AudioMute exec $signal vol toggle
XF86AudioMicMute exec $signal mic toggle
KP_Divide exec $signal vol 5%-
KP_Multiply exec $signal vol 5%+
Ctrl+KP_Divide exec $signal mic 2%-
Ctrl+KP_Multiply exec $signal mic 2%+
Shift+KP_Divide exec $signal vol toggle
Shift+KP_Multiply exec $signal mic toggle
$Alt+KP_Divide exec $signal wp
# Media management
$Mod+t exec twitch
$Mod+i exec notify-send -u low -a player -h string:synchronous:player\
-h int:value:$(($($info '{{position}}/({{mpris:length}}/100)')))\
"$($info '{{title}}')"\
"$($info '\t{{duration(position)}}/{{duration(mpris:length)}}' | sed 's/^ - //')"
$Mod+m exec mom -DGA -p
$Mod+$Alt+m exec mom -DGA -pLra
$Mod+Ctrl+$Alt+m exec mom -p "$($info '{{xesam:url}}' | urlencode -d | sed 's,file://\(.*/\)[^/]*$,\1,')"
$Mod+Ctrl+m exec xterm ranger --selectfile="$($info\
'{{xesam:url}}' | urlencode -d | sed 's,file://,,')"
Shift+XF86AudioStop exec pkill -f "mpv --no-audio-display" --signal 15
XF86AudioPlay exec $mpv play-pause
KP_Subtract exec playerctl -a play-pause
$Mod+$Alt+space exec playerctl -a play-pause
XF86AudioNext exec $mpv next
XF86AudioPrev exec $mpv prev
XF86AudioStop exec playerctl -a pause
$Alt+KP_Left exec $mpv position 5-
$Alt+KP_Right exec $mpv position 5+
$Alt+KP_Up exec $mpv position 30+
$Alt+KP_Down exec $mpv position 30-
}
bindgesture {
swipe:3:up exec $signal vol 1%+
swipe:3:right exec $signal vol 2%+
swipe:3:down exec $signal vol 1%-
swipe:3:left exec $signal vol 2%-
}