2021-07-26 15:56:06 +02:00
|
|
|
#!/bin/bash
|
2021-06-19 15:50:04 +02:00
|
|
|
|
2021-08-20 19:38:24 +02:00
|
|
|
if [ $(xrandr | grep DisplayPort | grep ' connected' | wc -l) -gt 0 ]; then
|
|
|
|
sink=$(pamixer --list-sinks | awk '/HDMI/ {print $1}')
|
2021-08-02 18:28:20 +02:00
|
|
|
else
|
2021-08-20 19:38:24 +02:00
|
|
|
sink=$(pamixer --list-sinks | awk '/HD Audio Controller/ {print $1}')
|
2021-08-02 18:28:20 +02:00
|
|
|
fi
|
2021-08-20 19:38:24 +02:00
|
|
|
|
|
|
|
case "${1}" in
|
|
|
|
"micmute")
|
|
|
|
case $(cat '/sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness') in
|
|
|
|
1) echo 0 | sudo tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness;;
|
|
|
|
0) echo 1 | sudo tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness;;
|
|
|
|
esac
|
|
|
|
device=$(pamixer --list-sources | awk '/Raven/ {print $1}')
|
|
|
|
for i in $(pamixer --list-sources | grep -v Sources | awk '{print $1}'); do
|
|
|
|
pamixer --source $i -t
|
|
|
|
done
|
|
|
|
kill -46 $(pidof dwmblocks)
|
|
|
|
exit ;;
|
|
|
|
"volmute")
|
|
|
|
for i in $(pamixer --list-sinks | grep -v Sinks | awk '{print $1}'); do
|
|
|
|
pamixer --sink $i -t
|
|
|
|
done
|
|
|
|
kill -46 $(pidof dwmblocks)
|
|
|
|
exit ;;
|
|
|
|
"increase")
|
|
|
|
pamixer --sink $sink --allow-boost -i 5
|
|
|
|
kill -46 $(pidof dwmblocks)
|
|
|
|
exit ;;
|
|
|
|
"decrease")
|
|
|
|
pamixer --sink $sink --allow-boost -d 5
|
|
|
|
kill -46 $(pidof dwmblocks)
|
|
|
|
exit ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
vol="$(pamixer --sink $sink --get-volume)"
|
|
|
|
[ $(echo $vol | wc -c) -lt 4 ] && svol=" ${vol}%%" || svol="${vol}%%"
|
2021-08-23 12:14:51 +02:00
|
|
|
[ $(pamixer --sink $sink --get-mute) = true ] && volinfo="^c#eeeeee^^b#005577^\ue04f mute^d^" || volinfo="\ue050 ${svol}"
|
2021-08-20 19:38:24 +02:00
|
|
|
device=$(pamixer --list-sources | awk '/Raven/ {print $1}')
|
2021-08-23 12:14:51 +02:00
|
|
|
[ $(pamixer --source $device --get-mute) = true ] && micinfo="^c#eeeeee^^b#005577^\ue02b^d^" || micinfo="\ue02a^d^"
|
2021-08-20 19:38:24 +02:00
|
|
|
printf "${micinfo} ${volinfo}"
|