diff options
author | awy <awy@tutamail.com> | 2024-08-27 17:36:26 +0300 |
---|---|---|
committer | awy <awy@tutamail.com> | 2024-08-27 17:36:26 +0300 |
commit | fd953c5191677355b789ea636f61de5a83fbf38c (patch) | |
tree | 1d4c45e6ffa8590fe2511f4ca7f5f8374c5781b5 /.local/bin/statusbar/sb-microphone | |
parent | 427dc591da83a94e352840c335ea41b96983e7e4 (diff) |
stuff
Diffstat (limited to '.local/bin/statusbar/sb-microphone')
-rwxr-xr-x | .local/bin/statusbar/sb-microphone | 38 |
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 |