MicMute support.

This commit is contained in:
Bartek Stalewski 2021-08-02 18:28:20 +02:00
parent dd6bab3469
commit 4a171c9665
2 changed files with 18 additions and 6 deletions

View File

@ -1,8 +1,19 @@
#!/bin/bash
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}')
[ $(pamixer --source $device --get-mute) = true ] && micinfo="^c#161616^^b#fd4285^\ue02b silent^d^" || micinfo="\ue02a listen"
printf "${volinfo} ${micinfo}"
if [ ${1} = "micmute" ]; then
pid=$(pgrep dbus-launch | head -n 1)
device=$(pamixer --list-sources | awk '/Raven/ {print $1}')
case `pamixer --source $device --get-mute` in
true) echo 0 | sudo tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness;;
false) echo 1 | sudo tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness;;
esac
pamixer --source $device -t
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}')
[ $(pamixer --source $device --get-mute) = true ] && micinfo="^c#161616^^b#fd4285^\ue02b silent^d^" || micinfo="\ue02a listen"
printf "${volinfo} ${micinfo}"
fi

View File

@ -141,6 +141,7 @@ static Key keys[] = {
{ SHTKEY, XK_comma, tagmon, {.i = -1 } },
{ SHTKEY, XK_period, tagmon, {.i = +1 } },
{ 0, XF86XK_AudioMute, spawn, SHCMD("pamixer -t; kill -46 $(pidof dwmblocks)") },
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("sb-volume micmute") },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pamixer --allow-boost -i 5; kill -46 $(pidof dwmblocks)") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --allow-boost -d 5; kill -46 $(pidof dwmblocks)") },
{ 0, XF86XK_MonBrightnessUp, spawn, SHCMD("sudo xbacklight -inc 10") },