#!/bin/bash

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
