Add eww/sh/values/volume.sh

This commit is contained in:
Candifloss 2024-08-01 17:28:37 +00:00
parent 1133218532
commit b5c790abec

31
eww/sh/values/volume.sh Normal file
View File

@ -0,0 +1,31 @@
#!/bin/bash
vol=$(amixer get Master | grep "Front\ Left:\ Playback.*%")
v=${vol#*\[}
s=${v#*\[}
v=${v%%\%*}
s=${s%%\]*}
if [[ $v == '0' ]]; then
s="empty";
ico="";
elif [[ "$s" == "on" ]]; then
s="low";
ico="";
if [[ $v -gt 35 ]]; then
s="med";
ico=""; fi
if [[ $v -gt 50 ]]; then
s="high";
ico=""; fi
if [[ $v -gt 80 ]]; then
s="vhigh";
ico=""; fi
if [[ $v -eq 100 ]]; then
s="full";
ico=""; fi
else
ico="";
fi
echo "{\"level\":\"$v\",\"status\":\"$s\",\"icon\":\"$ico\"}"