mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
* Add omarchy CLI * Remove outdated or internal * Add bash completions for command * Add omarchy command documentation * Add missing docs * Correct to what's now right * Fix tests --------- Co-authored-by: David Heinemeier Hansson <david@hey.com>
43 lines
1.4 KiB
Bash
Executable File
43 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Toggle microphone mute on Dell XPS systems. Uses wpctl for reliable toggling
|
|
|
|
wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle >/dev/null
|
|
|
|
if pactl get-source-mute @DEFAULT_SOURCE@ | rg -q 'yes'; then
|
|
alsa_value='off,off'
|
|
osd_message='Microphone muted'
|
|
osd_icon='microphone-sensitivity-muted-symbolic'
|
|
else
|
|
alsa_value='on,on'
|
|
osd_message='Microphone on'
|
|
osd_icon='audio-input-microphone-symbolic'
|
|
fi
|
|
|
|
if [[ -e /sys/class/leds/platform::micmute/brightness ]]; then
|
|
default_source=$(pactl get-default-source)
|
|
alsa_card=$(pactl -f json list sources | jq -r --arg source "$default_source" '
|
|
.[] | select(.name == $source) |
|
|
.properties["alsa.card"] // .properties["api.alsa.card"] // .properties["api.alsa.pcm.card"] // empty
|
|
' | head -1)
|
|
|
|
if [[ -n $alsa_card ]]; then
|
|
cards=("$alsa_card")
|
|
else
|
|
mapfile -t cards < <(compgen -G '/proc/asound/card*' | rg -o 'card[0-9]+' | sed 's/card//' | sort -u)
|
|
fi
|
|
|
|
for card in "${cards[@]}"; do
|
|
while IFS= read -r control; do
|
|
if [[ $control != *"Jack Microphone"* ]]; then
|
|
amixer -c "$card" cset "$control" "$alsa_value" >/dev/null 2>&1 || true
|
|
break 2
|
|
fi
|
|
done < <(amixer -c "$card" controls 2>/dev/null | rg -o "name='[^']*Microphone Capture Switch'")
|
|
done
|
|
fi
|
|
|
|
omarchy-swayosd-client \
|
|
--custom-message "$osd_message" \
|
|
--custom-icon "$osd_icon"
|