updated volume script, now using pipewire instead of pulseaudio
This commit is contained in:
parent
e81c786e0d
commit
729ef2847d
@ -1,36 +1,27 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
base03=#002b36
|
# Prints the current volume or if muted.
|
||||||
base02=#073642
|
|
||||||
base01=#586e75
|
|
||||||
base00=#657b83
|
|
||||||
base0=#839496
|
|
||||||
base1=#93a1a1
|
|
||||||
base2=#eee8d5
|
|
||||||
base3=#fdf6e3
|
|
||||||
yellow=#b58900
|
|
||||||
orange=#cb4b16
|
|
||||||
red=#dc322f
|
|
||||||
magenta=#d33682
|
|
||||||
violet=#6c71c4
|
|
||||||
blue=#268bd2
|
|
||||||
cyan=#2aa198
|
|
||||||
green=#859900
|
|
||||||
|
|
||||||
color=$cyan
|
vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
|
||||||
volume="$(amixer sget Master | grep 'Front Left')"
|
|
||||||
if [ "${volume}" = "${volume%\[off\]*}" ]
|
# If muted, print 🔇 and exit.
|
||||||
then
|
[ "$vol" != "${vol%\[MUTED\]}" ] && echo 🔇 && exit
|
||||||
volume="${volume#*\[}"
|
|
||||||
status="${volume%%\%\]*}"
|
vol="${vol#Volume: }"
|
||||||
case $((status/50)) in
|
split() {
|
||||||
0) icon="" ;; # fa-volume-down f027
|
# For ommiting the . without calling and external program.
|
||||||
1) icon="" ;; # fa-volume-up f028
|
IFS=$2
|
||||||
*) icon=""; color=$orange ;; # fa-volume-up f028
|
set -- $1
|
||||||
esac
|
printf '%s' "$@"
|
||||||
else
|
}
|
||||||
status=MUTE
|
vol="$(split "$vol" ".")"
|
||||||
color=$red
|
vol="${vol##0}"
|
||||||
icon="" # fa-volume-off f026
|
|
||||||
fi
|
case 1 in
|
||||||
echo "$icon $status"
|
$((vol >= 70)) ) icon="" ;;
|
||||||
|
$((vol >= 30)) ) icon="" ;;
|
||||||
|
$((vol >= 1)) ) icon="" ;;
|
||||||
|
* ) echo && exit ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "$icon $vol%"
|
||||||
|
|||||||
Reference in New Issue
Block a user