#!/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 '%') mic=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F' / ' '{print $2}' | tr -d '%') volmute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') micmute=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') if [ "$volmute" = yes ] && [ "$micmute" = yes ]; then printf "^c#161616^^b#fd4285^mute \ue02b mute \ue04f^d^" elif [ "$vol" -eq 0 ] && [ "$mic" -eq 0 ]; then printf "^c#161616^^b#fd4285^mute \ue02b mute \ue04f^d^" else [ $(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') = yes ] || [ "$vol" -eq 0 ] && volinfo="^c#161616^^b#fd4285^mute \ue04f^d^" || volinfo="${vol}%% \ue050" [ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && micinfo="^c#161616^^b#fd4285^\ue02b mute^d^" || micinfo="${mic}%% \ue029" printf "${micinfo} ${volinfo}" fi fi