mirror of
https://github.com/elenapan/dotfiles.git
synced 2025-12-26 15:14:58 +08:00
updated volume script to send notifications if the sidebar is not visible
This commit is contained in:
parent
dc475d5b6a
commit
9035303194
1 changed files with 28 additions and 0 deletions
|
|
@ -1,12 +1,18 @@
|
|||
#!/bin/bash
|
||||
# Control volume
|
||||
# Requires pulseaudio
|
||||
# AwesomeWM: Only sends a notification if the sidebar is not visible
|
||||
# --------------------------
|
||||
|
||||
# Steps for raising/lowering volume
|
||||
STEP=5
|
||||
BIG_STEP=25
|
||||
|
||||
# Notification config
|
||||
VOLUME_ICON=~/.config/awesome/themes/lovelace/icons/volume.png
|
||||
MUTED_ICON=~/.config/awesome/themes/lovelace/icons/muted.png
|
||||
NOTIF_ID=/tmp/volume-daemon-notification
|
||||
|
||||
if [[ "$1" = "up" ]]; then
|
||||
pactl set-sink-mute 0 0 && pactl set-sink-volume @DEFAULT_SINK@ +$STEP%
|
||||
elif [[ "$1" = "UP" ]]; then
|
||||
|
|
@ -17,6 +23,28 @@ elif [[ "$1" = "DOWN" ]]; then
|
|||
pactl set-sink-mute 0 0 && pactl set-sink-volume @DEFAULT_SINK@ -$BIG_STEP%
|
||||
elif [[ "$1" = "toggle" ]]; then
|
||||
pactl set-sink-mute 0 toggle
|
||||
elif [[ "$1" = "reset" ]]; then
|
||||
pactl set-sink-mute 0 0 && pactl set-sink-volume @DEFAULT_SINK@ 50%
|
||||
else
|
||||
echo "No argument."
|
||||
fi
|
||||
|
||||
SIDEBAR_VISIBLE="$(awesome-client 'return sidebar.visible' | awk '{print $2}')"
|
||||
echo $SIDEBAR_VISIBLE
|
||||
if [[ "$SIDEBAR_VISIBLE" == "false" ]]; then
|
||||
var=$(pactl list sinks)
|
||||
|
||||
case $var in
|
||||
*'Mute: yes'*)
|
||||
out="off"
|
||||
ICON=$MUTED_ICON
|
||||
;;
|
||||
*)
|
||||
# we want word splitting
|
||||
set -- ${var#*Volume:}
|
||||
out="$a$t$4"
|
||||
ICON=$VOLUME_ICON
|
||||
esac
|
||||
#echo "Volume: $out"
|
||||
notify-send --urgency low -R "$NOTIF_ID" -i $ICON "$out"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue