Files
nixos/scripts/WMScripts/microphone_bar.sh
T
2026-10-06 22:34:05 +02:00

42 lines
910 B
Bash
Executable File

#!/usr/bin/env bash
MUTE=" "
NORMAL=""
output () {
case "$XDG_CURRENT_DESKTOP" in
"sway"|"Hyprland")
if [[ -n "$1" ]]; then
echo "{\"text\": \"$NORMAL\", \"alt\": \"\", \"tooltip\": \"\", \"class\": \"unmuted-mike\", \"percentage\": 0}"
else
echo "{\"text\": \"$MUTE\", \"alt\": \"\", \"tooltip\": \"\", \"class\": \"muted-mike\", \"percentage\": 0}"
fi
;;
"i3")
if [[ -n "$1" ]]; then
echo "$NORMAL"
else
echo "%{F#707880}$MUTE%{T- F-}"
fi
;;
*)
dunstify -t 2000 -u low -i ~/.icons/candy-icons/apps/scalable/noisetorch.svg "This desktop is not supported."
exit
;;
esac
}
if [[ "$1" == "mute" ]]; then
amixer sset Capture toggle > /dev/null
fi
STATUS=$(amixer get Capture | tail -n1 | awk '{print $5}' -)
case $STATUS in
"[on]")
output "yes"
;;
*)
output
;;
esac