diff options
Diffstat (limited to '.local/bin')
-rwxr-xr-x | .local/bin/audio_cyclesink | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/.local/bin/audio_cyclesink b/.local/bin/audio_cyclesink index 52b2661..3726f70 100755 --- a/.local/bin/audio_cyclesink +++ b/.local/bin/audio_cyclesink @@ -56,22 +56,27 @@ cycle_sink() do case "$sink" in \**) - default_sink="${sinks#* }" + default_sink="${sink##* }" ;; *) - if [ -n "$default_sink" ] - then - next_sink="${sink# }" - break - fi + [ -z "$default_sink" ] && + continue + + next_sink="${sink##* }" + break ;; esac done # if default sink is last one use first sink - : "${next_sink:="${sinks%%:*}"}" + if [ -z "$next_sink" ] + then + next_sink="${sinks%%:*}" + next_sink="${next_sink##* }" + fi - wpctl set-default "$next_sink" + [ "$next_sink" != "$default_sink" ] && + wpctl set-default "$next_sink" } wpctl status | parse_sinks | cycle_sink |