-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit
executable file
·387 lines (288 loc) · 12.6 KB
/
init
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
376
377
378
379
380
381
382
383
384
385
386
387
#!/bin/dash
# vim:fileencoding=utf-8:foldmethod=marker
# This is configuration file for river.
#
# See the river(1), riverctl(1), and rivertile(1) man pages for complete
# documentation.
# Note: the "Super" modifier is also known as Logo, GUI, Windows, Mod4, etc.
########################
### APPS AND SCRIPTS ###
########################
# Config
dir="$HOME/.config/river"
# Apps
web="zen-browser"
fileManager="nemo"
emailManager="thunderbird"
passManager="keepassxc"
gameClient="lutris"
telegram="telegram-desktop"
discord="webcord"
musicClient="spotify-launcher"
calculator="galculator"
# Scripts
volume="$dir/scripts/volume.sh"
downloader="$dir/scripts/fuzzel_downloader.sh"
colorpicker="$dir/scripts/colorpicker.sh"
screenshot="$dir/scripts/screenshot.sh"
screenshoter="$dir/scripts/fuzzel_screenshoter.sh"
networkmanager="$dir/scripts/networkmanager.py"
sessionmanager="$dir/scripts/fuzzel_sessionmanager.sh"
clipmanager="$dir/scripts/fuzzel_clipmanager.sh"
runner="$dir/scripts/fuzzel_drun.sh"
asroot="$dir/scripts/fuzzel_asroot.sh"
#################
### AUTOSTART ###
#################
riverctl spawn "$dir/scripts/autostart.sh"
###############
### GENERAL ###
###############
### Colors -------------------------------------------------
riverctl background-color 0x2E3440
riverctl border-color-focused 0x81A1C1
riverctl border-color-unfocused 0x3B4252
riverctl border-color-urgent 0xA3BE8C
### Layout -------------------------------------------------
# Set the default layout generator to be rivertile and start it.
# River will send the process group of the init executable SIGTERM on exit.
riverctl default-layout rivertile
rivertile -view-padding 6 -outer-padding 6 -main-ratio 0.5 &
#############
### INPUT ###
#############
# Keyboard layout (xkblayout)
riverctl keyboard-layout -model pc105 -variant qwerty -options "grp:win_space_toggle" "us,ru"
# Set keyboard repeat rate
riverctl set-repeat 25 250
# Fix mouse sensitivity
riverctl input pointer-1133-49298-Logitech_G102_LIGHTSYNC_Gaming_Mouse pointer-accel -1.0
# Focus follows cursor
riverctl focus-follows-cursor normal
###################
### KEYBINDINGS ###
###################
### Apps ---------------------------------------------------
# Super+Shift + Return to start an instance of foot
riverctl map -layout 0 normal Super Return spawn footclient
# Super+T to start an instance of floating foot
riverctl map -layout 0 normal Super T spawn "footclient --app-id 'footclient-float' --window-size-pixels 1000x600"
### Control River ------------------------------------------
# Super+Shift+Q to exit river
riverctl map -layout 0 normal Super+Shift Q exit
# Super+Shift+R to reload river configuration
riverctl map -layout 0 normal Super+Shift R spawn "$dir/init"
# Super+C to close the focused view
riverctl map -layout 0 normal Super C close
### Tags ---------------------------------------------------
# Alt+Tab to focus previous tags
riverctl map -layout 0 normal Alt Tab focus-previous-tags
# Super+Period and Super+Comma to focus the next/previous output
riverctl map -layout 0 normal Super Period focus-output next
riverctl map -layout 0 normal Super Comma focus-output previous
# Super+Shift+{Period,Comma} to send the focused view to the next/previous output
riverctl map -layout 0 normal Super+Shift Period send-to-output next
riverctl map -layout 0 normal Super+Shift Comma send-to-output previous
### Views --------------------------------------------------
# Super+Return to bump the focused view to the top of the layout stack
riverctl map -layout 0 normal Super+Shift Return zoom
# Super+Shift+J and Super+Shift+K to swap the focused view with the next/previous
# view in the layout stack
riverctl map -layout 0 normal Super+Shift J swap next
riverctl map -layout 0 normal Super+Shift K swap previous
# Super+J and Super+K to focus the next/previous view in the layout stack
riverctl map -layout 0 normal Super J focus-view next
riverctl map -layout 0 normal Super K focus-view previous
# Super+Alt+{H,J,K,L} to move views
riverctl map -layout 0 normal Super+Alt H move left 100
riverctl map -layout 0 normal Super+Alt J move down 100
riverctl map -layout 0 normal Super+Alt K move up 100
riverctl map -layout 0 normal Super+Alt L move right 100
# Super+Alt+Control+{H,J,K,L} to snap views to screen edges
riverctl map -layout 0 normal Super+Alt+Control H snap left
riverctl map -layout 0 normal Super+Alt+Control J snap down
riverctl map -layout 0 normal Super+Alt+Control K snap up
riverctl map -layout 0 normal Super+Alt+Control L snap right
# Super+Alt+Shift+{H,J,K,L} to resize views
riverctl map -layout 0 normal Super+Alt+Shift H resize horizontal -100
riverctl map -layout 0 normal Super+Alt+Shift J resize vertical 100
riverctl map -layout 0 normal Super+Alt+Shift K resize vertical -100
riverctl map -layout 0 normal Super+Alt+Shift L resize horizontal 100
for i in $(seq 1 9); do
tags=$((1 << ($i - 1)))
# Super+[1-9] to focus tag [0-8]
riverctl map -layout 0 normal Super "$i" set-focused-tags $tags
# Super+Shift+[1-9] to tag focused view with tag [0-8]
riverctl map -layout 0 normal Super+Shift "$i" set-view-tags $tags
# Super+Control+[1-9] to toggle focus of tag [0-8]
riverctl map -layout 0 normal Super+Control "$i" toggle-focused-tags $tags
# Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view
riverctl map -layout 0 normal Super+Shift+Control "$i" toggle-view-tags $tags
done
### Windows ------------------------------------------------
# Super+Space to toggle float
riverctl map -layout 0 normal Super Z toggle-float
# Super+F to toggle fullscreen
riverctl map -layout 0 normal Super F toggle-fullscreen
### Layout -------------------------------------------------
# Super+H and Super+L to decrease/increase the main ratio of rivertile(1)
riverctl map -layout 0 normal Super H send-layout-cmd rivertile "main-ratio -0.05"
riverctl map -layout 0 normal Super L send-layout-cmd rivertile "main-ratio +0.05"
# Super+Shift+H and Super+Shift+L to increment/decrement the main count of rivertile(1)
riverctl map -layout 0 normal Super+Shift H send-layout-cmd rivertile "main-count +1"
riverctl map -layout 0 normal Super+Shift L send-layout-cmd rivertile "main-count -1"
# Super+{Up,Right,Down,Left} to change layout orientation
riverctl map -layout 0 normal Super Up send-layout-cmd rivertile "main-location top"
riverctl map -layout 0 normal Super Right send-layout-cmd rivertile "main-location right"
riverctl map -layout 0 normal Super Down send-layout-cmd rivertile "main-location bottom"
riverctl map -layout 0 normal Super Left send-layout-cmd rivertile "main-location left"
### Modes --------------------------------------------------
# Declare a passthrough mode. This mode has only a single mapping -layout 0 to return to
# normal mode. This makes it useful for testing a nested wayland compositor
riverctl declare-mode passthrough
# Super+F11 to enter passthrough mode
riverctl map -layout 0 normal Super F11 enter-mode passthrough
# Super+F11 to return to normal mode
riverctl map -layout 0 passthrough Super F11 enter-mode normal
# Various media key mapping -layout 0 examples for both normal and locked mode which do
# not have a modifier
for mode in normal locked; do
riverctl map -layout 0 $mode None XF86HomePage spawn "$web"
riverctl map -layout 0 $mode None XF86Explorer spawn "$fileManager"
riverctl map -layout 0 $mode None XF86Mail spawn "$emailManager"
riverctl map -layout 0 $mode None XF86Tools spawn "footclient --app-id 'footclient-float' --window-size-pixels 800x400 ncmpcpp -s visualizer -S playlist"
riverctl map -layout 0 $mode None XF86Calculator spawn "$calculator"
# Control pipewire volume with wpctl
riverctl map -layout 0 $mode None XF86AudioRaiseVolume spawn "$volume --inc"
riverctl map -layout 0 $mode None XF86AudioLowerVolume spawn "$volume --dec"
riverctl map -layout 0 $mode None XF86AudioMute spawn "$volume --toggle"
# Control MPRIS aware media players with playerctl
riverctl map -layout 0 $mode None XF86AudioNext spawn "playerctl next"
riverctl map -layout 0 $mode None XF86AudioPrev spawn "playerctl previous"
riverctl map -layout 0 $mode None XF86AudioPlay spawn "playerctl play-pause"
riverctl map -layout 0 $mode None XF86AudioStop spawn "playerctl stop"
done
### Scratchpad ---------------------------------------------
# Super+0 to focus all tags
# Super+Shift+0 to tag focused view with all tags
all_tags=$(((1 << 32) - 1))
riverctl map -layout 0 normal Super 0 set-focused-tags $all_tags
riverctl map -layout 0 normal Super+Shift 0 set-view-tags $all_tags
# The scratchpad will live on an unused tag. Which tags are used depends on your
# config, but rivers default uses the first 9 tags.
scratch_tag=$((1 << 9))
# Toggle the scratchpad with Super+P
riverctl map -layout 0 normal Super P toggle-focused-tags ${scratch_tag}
# Send windows to the scratchpad with Super+Shift+P
riverctl map -layout 0 normal Super+Shift P set-view-tags ${scratch_tag}
# Set spawn tagmask to ensure new windows don't have the scratchpad tag unless
# explicitly set.
all_but_scratch_tag=$((((1 << 32) - 1) ^ $scratch_tag))
riverctl spawn-tagmask ${all_but_scratch_tag}
### Screenlocker -------------------------------------------
# Control+Alt+L to lock screen
riverctl map -layout 0 normal Control+Alt L spawn "swaylock -C $dir/swaylock/swaylock.conf"
### Colorpicker --------------------------------------------
# Alt+P to pick color
riverctl map -layout 0 normal Alt P spawn "$colorpicker"
### Screenshot ---------------------------------------------
# Print to take screenshot
riverctl map -layout 0 normal None Print spawn "$screenshot --now"
# Control+Print to take screenshot in 5 seconds
riverctl map -layout 0 normal Control Print spawn "$screenshot --in5"
# Shift+Print to take screenshot in 10 seconds
riverctl map -layout 0 normal Shift Print spawn "$screenshot --in10"
# Super+Print to take screenshot of selected area
riverctl map -layout 0 normal Super Print spawn "$screenshot --area"
### Applets ------------------------------------------------
# Control + F1 to open the app launcher applet
riverctl map -layout 0 normal Control F1 spawn "fuzzel -p 'Apps ' --config='$dir/fuzzel/fuzzel.ini'"
# Super + R to open the app runner applet
riverctl map -layout 0 normal Super R spawn "$runner"
# Alt + R to open the app runner applet
riverctl map -layout 0 normal Alt R spawn "$asroot"
# Super + N to open the network manager applet
riverctl map -layout 0 normal Super N spawn "$networkmanager"
# Super + D to open the downloader applet
riverctl map -layout 0 normal Super D spawn "$downloader"
# Super + S to open the screenshoter applet
riverctl map -layout 0 normal Super S spawn "$screenshoter"
# Super + Q to open the session manager applet
riverctl map -layout 0 normal Super Q spawn "$sessionmanager"
# Super + V to open the clipboard manager applet
riverctl map -layout 0 normal Super V spawn "$clipmanager"
# Super + Left Mouse Button to move views
riverctl map-pointer normal Super BTN_LEFT move-view
# Super + Right Mouse Button to resize views
riverctl map-pointer normal Super BTN_RIGHT resize-view
# Super + Middle Mouse Button to toggle float
riverctl map-pointer normal Super BTN_MIDDLE toggle-float
#############
### RULES ###
#############
### Float -------------------------------------------------
float_apps="
*float*
galculator
"
for float_app in $float_apps; do
riverctl rule-add -app-id "$float_app" float
done
riverctl rule-add -app-id "firefox" -title "Library" float
riverctl rule-add -app-id "zen-alpha" -title "Library" float
### Tags --------------------------------------------------
# Tag 1 - Terminal multiplexer and session manager
riverctl rule-add -app-id "footclient-zellij" tags $((1 << 0))
# Tag 2 - IDE and dev-tools
riverctl rule-add -app-id "*jetbrains*" tags $((1 << 1))
# Tag 3 - Web Browser
tag3_apps="
firefox
zen-alpha
"
for tag3_app in $tag3_apps; do
riverctl rule-add -app-id "$tag3_app" tags $((1 << 2))
done
# Tag 4 - File manager
riverctl rule-add -app-id "nemo" tags $((1 << 3))
# Tag 5 - Documents
riverctl rule-add -app-id "zathura" tags $((1 << 4))
# Tag 6 - Gaming applications
tag6_apps="
steam
lutris
"
for tag6_app in $tag6_apps; do
riverctl rule-add -app-id "$tag6_app" tags $((1 << 5))
done
riverctl rule-add -title "Steam" tags $((1 << 5))
### SSD ----------------------------------------------------
ssd_apps="
bvnc
bssh
xarchiver
zen-alpha
firefox
piper
steam
nemo
vimiv
imv
mpv
qemu
avahi*
*Meld*
lutris
webcord
Waydroid
galculator
*telegram*
*pavucontrol*
org.pwmt.zathura
nm-connection-editor
polkit-gnome-authentication-agent-1
xdg-desktop-portal-gtk
"
for ssd_app in $ssd_apps; do
riverctl rule-add -app-id "$ssd_app" ssd
done