~yerinalexey/dotfiles

597d8714da0a68ede60c1662d2b368f53a5e2763 — Alexey Yerin 26 days ago a20b932
river: add volume bar with wob
3 files changed, 32 insertions(+), 12 deletions(-)

M river/init
D scripts/sway/update-volume-bar
A scripts/update-volume
M river/init => river/init +23 -2
@@ 53,8 53,8 @@ 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 pulsemixer --change-volume -5
riverctl map normal $mod+Shift bracketright spawn pulsemixer --change-volume +5
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


@@ 107,5 107,26 @@ pgrep mpd >/dev/null \

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

D scripts/sway/update-volume-bar => scripts/sway/update-volume-bar +0 -10
@@ 1,10 0,0 @@
#!/bin/sh

# Updates wob according to current Pulseaudio volume

vol=$(pulsemixer --get-volume | cut -d' ' -f 1)

# Prevent wob from crashing
[ $vol -gt 100 ] && vol=100

printf "%s\n" "$vol" >> "$SWAYSOCK.wob"

A scripts/update-volume => scripts/update-volume +9 -0
@@ 0,0 1,9 @@
#!/bin/sh

# Update pulseaudio volume
# TODO: ALSA support

pulsemixer --change-volume "$1"

newvol=$(pulsemixer --get-volume | cut -d" " -f1)
printf "%s\n" $newvol >> /tmp/wob-in