commits
tags
#!/bin/sh
# volume module -- dispatched by subcommand:
# volume.sh -> bar text / slider starting value, "NN%"
# volume.sh set NN% -> slider drag target
# volume.sh menu -> popup definition, read once at startup (see
# README, "Module-declared menus")
mode="${1:-get}"
case "$mode" in
menu)
echo 'popup : hover : slider'
echo "popup_set : \"$0 set\""
;;
get)
# awk does the arithmetic itself; no bc/bash/xargs needed
LC_ALL=C wpctl get-volume @DEFAULT_AUDIO_SINK@ 2>/dev/null |
LC_ALL=C awk '/Volume:/ {printf "%d%%\n", $2 * 100}'
;;
set)
wpctl set-volume @DEFAULT_AUDIO_SINK@ "$2"
;;
esac