~yerinalexey/dotfiles

ref: 597d8714da0a68ede60c1662d2b368f53a5e2763 dotfiles/river/init -rwxr-xr-x 3.2 KiB
597d8714Alexey Yerin river: add volume bar with wob 2 months ago
                                                                                
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
#!/bin/sh

mod="Mod4"

# Layout
riverctl layout rivertile left

# Move focus between windows
riverctl map normal $mod j focus-view next
riverctl map normal $mod k focus-view previous

# Swap windows
riverctl map normal $mod+Shift j swap next
riverctl map normal $mod+Shift k swap previous
riverctl map normal $mod+Shift h zoom

# Resize columns
riverctl map normal $mod h mod-main-factor -0.05
riverctl map normal $mod l mod-main-factor 0.05

# Move floating windows with mouse
riverctl map-pointer normal $mod BTN_LEFT move-view
riverctl map-pointer normal $mod BTN_RIGHT resize-view

# Toggle floating
riverctl map normal $mod Space toggle-float

# Quick launchers
riverctl map normal $mod Return spawn $TERMINAL
riverctl map normal $mod W spawn $BROWSER

# Start application launcher
riverctl map normal $mod D spawn bemenu-run -p "Run: "

# Fullscreen a view
riverctl map normal $mod F toggle-fullscreen

# Close current window
riverctl map normal $mod Q close

# Dismiss all notifications
riverctl map normal $mod+Shift D spawn fnottctl dismiss all

# Player controls
riverctl map normal $mod P spawn player-menu
riverctl map normal $mod bracketleft spawn playerctl-mod previous
riverctl map normal $mod backslash spawn playerctl-mod play-pause
riverctl map normal $mod bracketright spawn playerctl-mod next

# Music
riverctl map normal $mod+Shift M spawn $TERMINAL ncmpcpp
riverctl map normal $mod M spawn mpd-menu

# Volume stuff
riverctl map normal $mod v spawn $TERMINAL pulsemixer
riverctl map normal $mod+Shift bracketleft  spawn update-volume -5
riverctl map normal $mod+Shift bracketright spawn update-volume +5

# Emoji 🤪
riverctl map normal $mod semicolon spawn emoji-menu

# Copy password
riverctl map normal $mod apostrophe spawn pass-menu

# Log out/shut down
riverctl map normal $mod+Shift Q spawn shutdown-menu

# Tags
for tag in $(seq 1 9); do
	# I honestly don't know what is this magic but it works
	tagmask=$((1 << ($tag - 1)))

	riverctl map normal $mod               $tag set-focused-tags $tagmask
	riverctl map normal $mod+Shift         $tag set-view-tags $tagmask
	riverctl map normal $mod+Control       $tag toggle-focused-tags $tagmask
	riverctl map normal $mod+Shift+Control $tag toggle-view-tags $tagmask
done

## Options
# Focus follows cursor
riverctl focus-follows-cursor normal

# Border colors
riverctl border-color-unfocused '#282c34'
riverctl border-color-focused '#a2b0c4'

# No useless padding
riverctl view-padding 0
riverctl outer-padding 0

# Autostart
autostart() {
	prog="$1"
	shift 1

	killall -q "$prog"
	riverctl spawn "$prog" "$@"
}

autostart waybar
autostart fnott
autostart swaybg -i "$XDG_CONFIG_HOME"/wall.jpg

# Music!
pgrep mpd >/dev/null \
	|| riverctl spawn mpd

autostart mpDris2

# Volume bar
start_wob() {
	# Clean up
	[ -e /tmp/wob-in ] && rm /tmp/wob-in

	border="#ff282c34"
	background="#ff131e26"

	mkfifo /tmp/wob-in
	tail -f /tmp/wob-in | wob \
	  -a top -a right -M 20 \
	  -W 35 -H 400 \
	  --overflow-mode nowrap \
	  --bar-color "#ff61afef" --overflow-bar-color "#ffec7171" \
	  --border-color "$border" --overflow-border-color "$border" \
	  --background-color "$background" --overflow-background-color "$background" &
}

killall wob
start_wob

# Cron jobs
riverctl spawn pcrond-run