nix/package/swayscript/script/Sound.nix

18 lines
445 B
Nix
Raw Normal View History

2024-11-04 04:37:29 +03:00
{ ... }: {
text = ''
function sound_output_cycle() {
2024-11-12 14:11:40 +03:00
_notify_short
2024-11-04 04:37:29 +03:00
local IFS=$'\n'
local current=$(pactl get-default-sink)
local all=($(pactl list short sinks | cut -f2))
local i_current=$(_index_of ''${current} ''${all[@]})
local i_total=''${#all[@]}; ((i_total--))
local i_target=0
2024-11-04 04:37:29 +03:00
[[ "''${i_current}" -lt "''${i_total}" ]] && i_target=$((i_current+1))
2024-11-04 04:37:29 +03:00
pactl set-default-sink ''${all[''${i_target}]}
}
'';
2024-04-06 03:03:58 +03:00
}