aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2024-11-17 12:18:49 +0000
committerJustine Smithies <justine@smithies.me.uk>2024-11-17 12:18:49 +0000
commit356158be99451fa24320fb0c96a3dafda47989d4 (patch)
tree986922f4e7ece97ea30a46fed17ef76e9e8d7466
parentc105cb5f01c363bb35a8773b7921ebafb39d8cf3 (diff)
Save and restore audio volume.
-rwxr-xr-x.config/eww/scripts/volumecontrol3
-rwxr-xr-x.config/river/autostart.sh4
2 files changed, 7 insertions, 0 deletions
diff --git a/.config/eww/scripts/volumecontrol b/.config/eww/scripts/volumecontrol
index 2168429..8134d00 100755
--- a/.config/eww/scripts/volumecontrol
+++ b/.config/eww/scripts/volumecontrol
@@ -57,6 +57,7 @@ case $1 in
# Up the volume (+ 2%)
# pactl set-sink-volume @DEFAULT_SINK@ +2%
mixer vol.volume=+2%
+ mixer vol > ~/.cache/audio-volume
send_notification
# canberra-gtk-play -i audio-volume-change
;;
@@ -65,6 +66,7 @@ case $1 in
mixer vol.mute=off
# pactl set-sink-volume @DEFAULT_SINK@ -2%
mixer vol.volume=-2%
+ mixer vol > ~/.cache/audio-volume
send_notification
# canberra-gtk-play -i audio-volume-change
;;
@@ -72,6 +74,7 @@ case $1 in
# Toggle mute
# pactl set-sink-mute @DEFAULT_SINK@ toggle
mixer vol.mute=toggle
+ mixer vol > ~/.cache/audio-volume
if is_mute ; then
icon="󰝟"
fyi --hint=string:x-canonical-private-synchronous:volumecontrol -u normal "$icon Audio Muted"
diff --git a/.config/river/autostart.sh b/.config/river/autostart.sh
index 00ea0a5..c2be8d7 100755
--- a/.config/river/autostart.sh
+++ b/.config/river/autostart.sh
@@ -27,6 +27,10 @@ wlsunset -l 57.4 -L -1.9 &
# Restore previous brightness
backlight $(grep 'brightness:' ~/.cache/brightness | awk '{print $2}')
+# Restore audio volume
+mixer vol.volume=$(grep 'vol.volume=' ~/.cache/audio-volume | awk -F ':' '{print $2}')
+mixer vol.mute=$(grep 'vol.mute=' ~/.cache/audio-volume | awk -F '=' '{print $2}')
+
export wallpaper=$( echo $wallpaper)
pkill -f swayidle