From 0fa563213156901f33c807ba622a0c8a97b5e72a Mon Sep 17 00:00:00 2001 From: Bartek Stalewski Date: Tue, 10 Aug 2021 15:39:53 +0200 Subject: [PATCH] sb-volume now mutes all mics. --- _suckless/_scripts/sb-volume | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/_suckless/_scripts/sb-volume b/_suckless/_scripts/sb-volume index 4687edc..48e598a 100755 --- a/_suckless/_scripts/sb-volume +++ b/_suckless/_scripts/sb-volume @@ -1,19 +1,20 @@ #!/bin/bash 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;; + 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 - pamixer --source $device -t + 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) 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}" + [ $(pamixer --source $device --get-mute) = true ] && micinfo="^c#161616^^b#fd4285^\ue02b^d^" || micinfo="\ue02a^d^" + printf "${micinfo} ${volinfo}" fi