1
0
Fork 0
dotfiles/.config/eww/scripts/volumelabel
2022-03-20 03:19:38 -04:00

20 lines
633 B
Bash
Executable file

#!/usr/bin/env bash
raw_percent=$(pamixer --get-volume-human)
if [ "$raw_percent" == "muted" ]; then
echo "{\"icon\": \"\", \"content\": \"(label :class \\\"volume__label\\\" :text \\\"muted\\\")\"}"
else
percent=$(echo "$raw_percent" | sed 's/[^0-9]*//g')
#if [ "$percent" -gt 66 ]; then
# icon=""
#elif [ "$percent" -gt 33 ]; then
# icon=""
#elif [ "$percent" -gt 0 ]; then
# icon=""
#else
# icon=""
#fi
icon=""
volume="$percent%"
echo "{\"icon\": \"${icon}\", \"content\": \"(label :class \\\"volume__label\\\" :text \\\"${volume}\\\")\"}"
fi