sway_volume: update toggle for more than 2 sinks
This commit is contained in:
parent
ff9b5c93a1
commit
bd21fbe4ca
1 changed files with 6 additions and 5 deletions
|
@ -14,8 +14,8 @@ function _get_default_sink() {
|
|||
pactl info | grep "Default Sink" | cut -d ' ' -f 3
|
||||
}
|
||||
|
||||
function _get_sink_nick() {
|
||||
pactl -f json list sinks | jq -c ".[] | select(.name | contains(\"$1\")) | .properties.\"device.nick\"" | sed 's/"//g'
|
||||
function _get_sink_desc() {
|
||||
pactl -f json list sinks | jq -c ".[] | select(.name | contains(\"$1\")) | .description" | sed 's/"//g'
|
||||
}
|
||||
|
||||
function notify() {
|
||||
|
@ -24,7 +24,7 @@ function notify() {
|
|||
SOURCE_VOLUME=$(pactl list sources | grep "Name: $SOURCE" -A 8 | grep -oE '[0-9]*%' | head -n 1 | sed 's/%//')
|
||||
MUTE=$(pactl list sinks | grep "Name: $SINK" -A 8 | grep 'Mute:' | cut -d " " -f 2)
|
||||
SOURCE_MUTE=$(pactl list sources | grep "Name: $SOURCE" -A 8 | grep 'Mute:' | cut -d " " -f 2)
|
||||
NICK=$(_get_sink_nick $SINK)
|
||||
DESC=$(_get_sink_desc $SINK)
|
||||
|
||||
ICON=$ICON_PATH/audio-volume-high.svg
|
||||
SINK_ICON=""
|
||||
|
@ -43,11 +43,12 @@ function notify() {
|
|||
fi
|
||||
TITLE="${SINK_ICON} ${SINK_VOLUME}% / ${SOURCE_ICON} ${SOURCE_VOLUME}%"
|
||||
# $NOTIFY_APP -i $ICON -a "Volume" "$TEXT"
|
||||
$NOTIFY_APP -i $ICON "$TITLE" "$NICK\n$(getProgressString 10 "$VOL1" "$VOL2" $SINK_VOLUME)"
|
||||
$NOTIFY_APP -i $ICON "$TITLE" "$DESC\n$(getProgressString 10 "$VOL1" "$VOL2" $SINK_VOLUME)"
|
||||
}
|
||||
|
||||
function _toggle_sink() {
|
||||
sink_next=$(pactl list sinks | grep node\.name | grep -oE '"[a-zA-Z0-9_.-]*"' | grep -v $1 | sed 's/"//g' | sort -R)
|
||||
sink_next=$(pactl list sinks | grep node\.name | grep -oE '"[a-zA-Z0-9_.-]*"' | grep -v $1 | sed 's/"//g' | sort -R | head -n 1)
|
||||
echo "$sink_next"
|
||||
pactl set-default-sink $sink_next
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue