refactor!: import modules recursively

This commit is contained in:
Moritz Böhme 2023-05-11 17:33:14 +02:00
parent f9fd542206
commit 9567cce5fa
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
35 changed files with 227 additions and 178 deletions

View file

@ -0,0 +1,24 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "cycle_sinks";
runtimeInputs = with pkgs; [ pulseaudio ];
text = ''
# get the default sink
default_sink="$(pactl info | grep -e "Default Sink:" | awk '{print $3}')"
echo "current default: $default_sink"
# get the sinks
sinks="$(pactl list sinks short | awk '{print $2}')"
# filter out the default sink
not_active="$(echo "$sinks" | grep -v -e "$default_sink")"
# get the sink after the dafault one
next_sink="$(echo -e "$sinks\n$not_active" | grep -e "$default_sink" -A 1 | tail -n 1 )"
# set the new default-sink
pactl set-default-sink "$next_sink"
echo "new default: $next_sink"
'';
}