Seperate vol val scripts for mono and left/right

This commit is contained in:
Candifloss 2025-01-08 20:54:19 +05:30
parent 8a84e91d8e
commit 0ef723038b
3 changed files with 61 additions and 31 deletions

View File

@ -1,31 +0,0 @@
#!/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\"}"

1
sh/values/vol/volume.sh Symbolic link
View File

@ -0,0 +1 @@
volume_mono.sh

31
sh/values/vol/volume_dual.sh Executable 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\"}"

29
sh/values/vol/volume_mono.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
vol=$(amixer get Master | grep "Mono: Playback" | sed -n 's/.*Mono: Playback [0-9]* \[\([0-9]*\)%\].*\[\(.*\)\]/\1 \2/p')
v=${vol%% *} # Volume percentage (18%)
s=${vol#* } # Mute status (on/off)
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\"}"