speedwm-personal/modules/module_vol

46 lines
902 B
Plaintext
Raw Normal View History

#!/bin/sh
# ram module for status/stellar
# values
VOL_VOLUME="$(speedwm-audioctrl -getvol)"
VOL_ISPULSE="$(speedwm-audioctrl -getbackend)"
ICON="$1"
BUTTON="$(cat /tmp/speedwm-button)"
# load status config
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
. $HOME/.config/speedwm-de/status/config
if [ "$1" = "" ]; then
ICON="$ITEM4_ICON"
fi
fi
case "$TERMINAL" in
"") TERMINAL=st
esac
case "$BUTTON" in
"3") $TERMINAL speedwm-audioctrl -runmixer ; exit ;;
esac
# no spacing if there's no icon
if [ "$ICON" != "" ]; then
ICONSPACING=" " # one character spacing
fi
# send the notification
SEND_NOTIF() {
FULL_VOL="${ICON}${ICONSPACING}$VOL_VOLUME"
notify-send "$FULL_VOL"
echo "Notification sent successfully!"
echo "INFO: $FULL_VOL"
exit 0
}
command -v notify-send > /dev/null && SEND_NOTIF
echo "FATAL: libnotify not installed, can't send notification."
exit 1