From 0ef723038b99932fb8bb35210d1a1fb6b1eb166b Mon Sep 17 00:00:00 2001 From: candifloss Date: Wed, 8 Jan 2025 20:54:19 +0530 Subject: [PATCH] Seperate vol val scripts for mono and left/right --- sh/values/vol/volume.sh | 32 +------------------------------- sh/values/vol/volume_dual.sh | 31 +++++++++++++++++++++++++++++++ sh/values/vol/volume_mono.sh | 29 +++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 31 deletions(-) mode change 100755 => 120000 sh/values/vol/volume.sh create mode 100755 sh/values/vol/volume_dual.sh create mode 100755 sh/values/vol/volume_mono.sh 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\"}"