diff --git a/sh/values/vol/volume.sh b/sh/values/vol/volume.sh deleted file mode 100755 index 20171dc..0000000 --- a/sh/values/vol/volume.sh +++ /dev/null @@ -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\"}" \ No newline at end of file diff --git a/sh/values/vol/volume.sh b/sh/values/vol/volume.sh new file mode 120000 index 0000000..06603d8 --- /dev/null +++ b/sh/values/vol/volume.sh @@ -0,0 +1 @@ +volume_mono.sh \ No newline at end of file diff --git a/sh/values/vol/volume_dual.sh b/sh/values/vol/volume_dual.sh new file mode 100755 index 0000000..20171dc --- /dev/null +++ b/sh/values/vol/volume_dual.sh @@ -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\"}" \ No newline at end of file diff --git a/sh/values/vol/volume_mono.sh b/sh/values/vol/volume_mono.sh new file mode 100755 index 0000000..c1d1af6 --- /dev/null +++ b/sh/values/vol/volume_mono.sh @@ -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\"}"