#!/bin/bash

# omarchy:summary=Toggle microphone mute. Drives the hardware mic-mute LED on laptops that expose one.

wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle >/dev/null

if pactl get-source-mute @DEFAULT_SOURCE@ | rg -q 'yes'; then
  led=on
  osd_message='Microphone muted'
  osd_icon='microphone-sensitivity-muted-symbolic'
else
  led=off
  osd_message='Microphone on'
  osd_icon='audio-input-microphone-symbolic'
fi

omarchy-brightness-keyboard-mute "$led"

omarchy-swayosd-client \
  --custom-message "$osd_message" \
  --custom-icon "$osd_icon"
