2020-02-08 23:43:37 +00:00
|
|
|
#!/bin/sh
|
2019-11-23 21:23:24 +00:00
|
|
|
|
2020-06-14 23:13:13 +00:00
|
|
|
# Prints the current volume or 🔇 if muted.
|
2020-04-09 21:03:51 +00:00
|
|
|
|
2019-11-23 21:23:24 +00:00
|
|
|
case $BLOCK_BUTTON in
|
2020-05-30 21:01:18 +00:00
|
|
|
1) setsid -f "$TERMINAL" -e pulsemixer ;;
|
2023-01-15 05:26:57 +00:00
|
|
|
2) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;;
|
|
|
|
4) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ ;;
|
|
|
|
5) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- ;;
|
2020-04-09 02:01:51 +00:00
|
|
|
3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
|
2019-11-23 21:23:24 +00:00
|
|
|
- Middle click to mute.
|
2020-05-07 21:31:42 +00:00
|
|
|
- Scroll to change." ;;
|
|
|
|
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
2019-11-23 21:23:24 +00:00
|
|
|
esac
|
|
|
|
|
2022-10-02 19:25:29 +00:00
|
|
|
vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
|
2019-11-23 21:23:24 +00:00
|
|
|
|
2022-10-02 19:25:29 +00:00
|
|
|
# If muted, print 🔇 and exit.
|
|
|
|
[ "$vol" != "${vol%\[MUTED\]}" ] && echo 🔇 && exit
|
2019-11-23 21:23:24 +00:00
|
|
|
|
2022-10-02 19:25:29 +00:00
|
|
|
vol="${vol#Volume: }"
|
|
|
|
split() {
|
|
|
|
# For ommiting the . without calling and external program.
|
|
|
|
IFS=$2
|
|
|
|
set -- $1
|
|
|
|
printf '%s' "$@"
|
|
|
|
}
|
|
|
|
vol="$(split "$vol" ".")"
|
|
|
|
vol="${vol##0}"
|
|
|
|
|
|
|
|
case 1 in
|
|
|
|
$((vol >= 70)) ) icon="🔊" ;;
|
|
|
|
$((vol >= 30)) ) icon="🔉" ;;
|
|
|
|
$((vol >= 1)) ) icon="🔈" ;;
|
|
|
|
* ) echo 🔇 && exit ;;
|
|
|
|
esac
|
2019-11-23 21:23:24 +00:00
|
|
|
|
2021-10-18 12:50:15 +00:00
|
|
|
echo "$icon$vol%"
|