dotfiles/_suckless/_scripts/sb-volume

21 lines
974 B
Plaintext
Raw Normal View History

2021-07-26 15:56:06 +02:00
#!/bin/bash
2021-06-19 15:50:04 +02:00
2021-08-02 18:28:20 +02:00
if [ ${1} = "micmute" ]; then
2021-08-10 15:39:53 +02:00
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;;
2021-08-02 18:28:20 +02:00
esac
2021-08-10 15:39:53 +02:00
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
2021-08-02 18:28:20 +02:00
kill -46 $(pidof dwmblocks)
else
vol="$(pamixer --get-volume)"
[ $(echo $vol | wc -c) -lt 4 ] && svol=" ${vol}%%" || svol="${vol}%%"
[ $(pamixer --get-mute) = true ] && volinfo="^c#161616^^b#fd4285^\ue04f mute^d^" || volinfo="\ue050 ${svol}"
device=$(pamixer --list-sources | awk '/Raven/ {print $1}')
2021-08-10 15:39:53 +02:00
[ $(pamixer --source $device --get-mute) = true ] && micinfo="^c#161616^^b#fd4285^\ue02b^d^" || micinfo="\ue02a^d^"
printf "${micinfo} ${volinfo}"
2021-08-02 18:28:20 +02:00
fi