From b5c790abec36905eeb10ed625d8bcc26ac84552c Mon Sep 17 00:00:00 2001 From: Candifloss Date: Thu, 1 Aug 2024 17:28:37 +0000 Subject: [PATCH] Add eww/sh/values/volume.sh --- eww/sh/values/volume.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 eww/sh/values/volume.sh diff --git a/eww/sh/values/volume.sh b/eww/sh/values/volume.sh new file mode 100644 index 0000000..a9e2d25 --- /dev/null +++ b/eww/sh/values/volume.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