20 lines
907 B
Bash
Executable File
20 lines
907 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ "${1}" = "micmute" ]; then
|
|
state=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}')
|
|
case ${state} in
|
|
yes)
|
|
echo 0 | doas tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
|
|
pactl set-source-mute @DEFAULT_SOURCE@ 0 ;;
|
|
no)
|
|
echo 1 | doas tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
|
|
pactl set-source-mute @DEFAULT_SOURCE@ 1 ;;
|
|
esac
|
|
kill -46 $(pidof dwmblocks)
|
|
else
|
|
vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F' / ' '{print $2}' | tr -d '%')
|
|
[ $(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') = yes ] && volinfo="^c#161616^^b#fd4285^\ue04f mute^d^" || volinfo="\ue050 ${vol}%%"
|
|
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] && micinfo="^c#161616^^b#fd4285^\ue02b^d^" || micinfo="\ue02a^d^"
|
|
printf "${micinfo} ${volinfo}"
|
|
fi
|