summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2022-12-07 13:57:09 -0500
committerGalen Guyer <galen@galenguyer.com>2022-12-07 13:57:09 -0500
commit0bb1e90c8b2461040449d81aa114f29f6621ef7c (patch)
tree422f87002fb32dc91b8a68db2d0c9b5586204069
parent33e99935b0c4477f87aac470411056cb20b42a7f (diff)
Mute audio on screen lock
-rwxr-xr-xext/lock.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/lock.sh b/ext/lock.sh
index d3ca4c4..d8677f2 100755
--- a/ext/lock.sh
+++ b/ext/lock.sh
@@ -11,17 +11,18 @@ convert /tmp/.lockscreen.png \
convert -composite -gravity center /tmp/.lockscreen.png "$HOME/.dots/ext/lock-overlay.png" /tmp/.lockscreen.png
-# Turn on DND
-#old_dnd="$(xfconf-query -c xfce4-notifyd -p /do-not-disturb)"
-#xfconf-query -c xfce4-notifyd -p /do-not-disturb -s true
-
# Pause stuff and mute audio
+_muted="$(pacmd list-sinks | awk '/muted/ { print $2 }')"
+[[ "$_muted" == "no" ]] && pactl set-sink-mute @DEFAULT_SINK@ 1
#playerctl -a pause > /dev/null
-#old_mute="$(amixer get Master | tail -2 | grep '\[on\]')"
#amixer set Master mute > /dev/null
+# Turn on DND
+#old_dnd="$(xfconf-query -c xfce4-notifyd -p /do-not-disturb)"
+#xfconf-query -c xfce4-notifyd -p /do-not-disturb -s true
+
i3lock --nofork --ignore-empty-password --show-failed-attempts --image /tmp/.lockscreen.png &
# Set settings back to what they were before
-#test -z "$old_mute" || amixer set Master unmute > /dev/null
#test "$old_dnd" = false && xfconf-query -c xfce4-notifyd -p /do-not-disturb -s false
+[[ "$_muted" == "no" ]] && pactl set-sink-mute @DEFAULT_SINK@ 0