Fix waybar sound script on linux when muted.
This commit is contained in:
parent
f3edf7d8c1
commit
1ae5212241
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Read volume status in FreeBSD
|
||||
# Read volume status in Linux
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
@ -9,8 +9,12 @@ SLEEP_INTERVAL=${SLEEP_INTERVAL:-30}
|
||||
|
||||
while true; do
|
||||
current_vol_decimal=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | sed 's/Volume: //g')
|
||||
current_vol_percent=$(bc -s <<<"$current_vol_decimal * 100")
|
||||
current_vol_percent=${current_vol_percent%.*} # Remove decimal
|
||||
if [[ "$current_vol_decimal" = *MUTED* ]]; then
|
||||
current_vol_percent=0
|
||||
else
|
||||
current_vol_percent=$(bc -s <<<"$current_vol_decimal * 100")
|
||||
current_vol_percent=${current_vol_percent%.*} # Remove decimal
|
||||
fi
|
||||
tooltip="<tt>$(wpctl status)</tt>"
|
||||
tooltip=${tooltip//$'\n'/\\n}
|
||||
tooltip=${tooltip//$'\t'/\\t}
|
||||
|
Loading…
x
Reference in New Issue
Block a user