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-microphone50
1 files changed, 24 insertions, 26 deletions
diff --git a/.local/bin/statusbar/sb-microphone b/.local/bin/statusbar/sb-microphone
index 01a44cf..339fb78 100755
--- a/.local/bin/statusbar/sb-microphone
+++ b/.local/bin/statusbar/sb-microphone
@@ -1,6 +1,21 @@
#!/bin/sh
-var=$1
-mic="$(wpctl get-volume @DEFAULT_SOURCE@)"
+
+# Prints the current microphone volume or  if muted.
+
+case $1 in
+ 1) kitty -e pulsemixer ;;
+ 3) notify-send "🎤 Microphone volume module" "\- Shows volume 🎙️,  if muted.
+- Middle click to mute.
+- Scroll to change." ;;
+ 6) kitty -e "$EDITOR" "$0" ;;
+esac
+
+vol="$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@)"
+
+# If muted, print  and exit.
+[ "$vol" != "${vol%\[MUTED\]}" ] && echo  && exit
+
+vol="${vol#Volume: }"
split() {
# For ommiting the . without calling and external program.
@@ -9,28 +24,11 @@ split() {
printf '%s' "$@"
}
-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
-}
+vol="$(printf "%.0f" "$(split "$vol" ".")")"
+
+case 1 in
+ $((vol >= 1)) ) icon="🎙️" ;;
+ * ) echo  && exit ;;
+esac
-[ "$mic" != "${mic%\[MUTED\]}" ] && icon="" && flag=1 && sig
-mic="${mic#Volume: }"
-mic="$(printf "%.0f" "$(split "$mic" ".")")"
-sig
+echo "$icon $vol%"