aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/sb-microphone
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/statusbar/sb-microphone')
-rwxr-xr-x.local/bin/statusbar/sb-microphone38
1 files changed, 25 insertions, 13 deletions
diff --git a/.local/bin/statusbar/sb-microphone b/.local/bin/statusbar/sb-microphone
index e07e0de..01a44cf 100755
--- a/.local/bin/statusbar/sb-microphone
+++ b/.local/bin/statusbar/sb-microphone
@@ -1,12 +1,7 @@
#!/bin/sh
-
+var=$1
mic="$(wpctl get-volume @DEFAULT_SOURCE@)"
-# If muted, print 🔇 and exit.
-[ "$mic" != "${mic%\[MUTED\]}" ] && echo  && exit
-
-mic="${mic#Volume: }"
-
split() {
# For ommiting the . without calling and external program.
IFS=$2
@@ -14,11 +9,28 @@ split() {
printf '%s' "$@"
}
-mic="$(printf "%.0f" "$(split "$mic" ".")")"
-
-case 1 in
- $((mic >= 1)) ) icon="🎙️" ;;
- * ) echo  && exit ;;
-esac
+sig() {
+ if [ ! -n "$var" ]; then
+ if [ -n "$flag" ] ; then
+ echo "$icon"
+ else
+ case 1 in
+ $((mic >= 1)) ) icon="🎙️" ;;
+ * ) echo  && exit ;;
+ esac
+ echo "$icon $mic%"
+ fi
+ else
+ if [ "$var" -eq 3 ]; then
+ notify-send "🎤 Microphone module" "\- Shows volume 🎙️,  if muted.
+- Middle click to mute.
+- Scroll to change."
+ fi
+ fi
+ exit
+}
-echo "$icon $mic%"
+[ "$mic" != "${mic%\[MUTED\]}" ] && icon="" && flag=1 && sig
+mic="${mic#Volume: }"
+mic="$(printf "%.0f" "$(split "$mic" ".")")"
+sig