aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/sb-volume
diff options
context:
space:
mode:
authorawy <awy@tutamail.com>2024-08-27 17:36:26 +0300
committerawy <awy@tutamail.com>2024-08-27 17:36:26 +0300
commitfd953c5191677355b789ea636f61de5a83fbf38c (patch)
tree1d4c45e6ffa8590fe2511f4ca7f5f8374c5781b5 /.local/bin/statusbar/sb-volume
parent427dc591da83a94e352840c335ea41b96983e7e4 (diff)
stuff
Diffstat (limited to '.local/bin/statusbar/sb-volume')
-rwxr-xr-x.local/bin/statusbar/sb-volume42
1 files changed, 27 insertions, 15 deletions
diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume
index e3501d1..06dd23a 100755
--- a/.local/bin/statusbar/sb-volume
+++ b/.local/bin/statusbar/sb-volume
@@ -1,12 +1,7 @@
#!/bin/sh
-
+var=$1
vol="$(wpctl get-volume @DEFAULT_SINK@)"
-# If muted, print 🔇 and exit.
-[ "$vol" != "${vol%\[MUTED\]}" ] && echo 🔇 && exit
-
-vol="${vol#Volume: }"
-
split() {
# For ommiting the . without calling and external program.
IFS=$2
@@ -14,13 +9,30 @@ split() {
printf '%s' "$@"
}
-vol="$(printf "%.0f" "$(split "$vol" ".")")"
-
-case 1 in
- $((vol >= 70)) ) icon="🔊" ;;
- $((vol >= 30)) ) icon="🔉" ;;
- $((vol >= 1)) ) icon="🔈" ;;
- * ) echo 🔇 && exit ;;
-esac
+sig() {
+ if [ ! -n "$var" ]; then
+ if [ -n "$flag" ] ; then
+ echo "$icon"
+ else
+ case 1 in
+ $((vol >= 70)) ) icon="🔊" ;;
+ $((vol >= 30)) ) icon="🔉" ;;
+ $((vol >= 1)) ) icon="🔈" ;;
+ * ) echo 🔇 && exit ;;
+ esac
+ echo "$icon $vol%"
+ fi
+ else
+ if [ "$var" -eq 3 ]; then
+ notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
+- Middle click to mute.
+- Scroll to change."
+ fi
+ fi
+ exit
+}
-echo "$icon $vol%"
+[ "$vol" != "${vol%\[MUTED\]}" ] && icon="🔇" && flag=1 && sig
+vol="${vol#Volume: }"
+vol="$(printf "%.0f" "$(split "$vol" ".")")"
+sig