blob: e07e0de888fbcea981362818d984b88cb09020ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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%"
|