This repository has been archived on 2019-02-28. You can view files and clone it, but cannot push or open issues or pull requests.
2018-08-11 02:11:42 +02:00

20 lines
545 B
Bash

[[ "$BLOCK_INSTANCE" =~ "mic" ]] && DEV="Capture" || DEV="Master"
[[ "$BLOCK_BUTTON" == 2 ]] && pavucontrol &
[[ "$BLOCK_BUTTON" == 3 ]] && amixer set $DEV toggle &> /dev/null
if [[ $(amixer get $DEV) =~ \[([0-9]+)\%\][[:space:]]\[(on|off)\] ]]; then
LOAD=${BASH_REMATCH[1]}
STATE=${BASH_REMATCH[2]}
if [[ "$STATE" == "on" ]]; then
LONG_TEXT="${LOAD}%"
SHORT_TEXT="${LOAD}"
else
LONG_TEXT="off"
SHORT_TEXT="X"
EXIT=True
fi
else
LONG_TEXT="no audio source"
SHORT_TEXT="n/a"
fi