From 8c24921832b2b6dc95bbb41dbfe2de7ff4fcf877 Mon Sep 17 00:00:00 2001 From: awy Date: Tue, 27 Aug 2024 03:44:14 +0300 Subject: update --- .local/bin/statusbar/sb-microphone | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 .local/bin/statusbar/sb-microphone (limited to '.local/bin/statusbar/sb-microphone') diff --git a/.local/bin/statusbar/sb-microphone b/.local/bin/statusbar/sb-microphone new file mode 100755 index 0000000..e07e0de --- /dev/null +++ b/.local/bin/statusbar/sb-microphone @@ -0,0 +1,24 @@ +#!/bin/sh + +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 + set -- $1 + printf '%s' "$@" +} + +mic="$(printf "%.0f" "$(split "$mic" ".")")" + +case 1 in + $((mic >= 1)) ) icon="🎙️" ;; + * ) echo  && exit ;; +esac + +echo "$icon $mic%" -- cgit v1.2.3