mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-05 08:00:14 +00:00
switch audio with rofi and add extraLib
This commit is contained in:
@ -17,6 +17,10 @@
|
||||
type = lib.types.str;
|
||||
description = "Command to use for choosing windows";
|
||||
};
|
||||
audioSwitchCommand = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Command to use for switching audio sink";
|
||||
};
|
||||
toggleBarCommand = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Command to hide and show the status bar.";
|
||||
|
@ -112,6 +112,8 @@ in {
|
||||
"exec --no-startup-id ${config.launcherCommand}";
|
||||
"${modifier}+Shift+s" =
|
||||
"exec --no-startup-id ${config.systemdSearch}";
|
||||
"${modifier}+Shift+a" =
|
||||
"exec --no-startup-id ${config.audioSwitchCommand}";
|
||||
"Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}";
|
||||
"${modifier}+Shift+c" = "reload";
|
||||
"${modifier}+Shift+r" = "restart";
|
||||
|
@ -155,7 +155,16 @@
|
||||
altTabCommand = "${
|
||||
config.home-manager.users.${config.user}.programs.rofi.finalPackage
|
||||
}/bin/rofi -show window -modi window";
|
||||
|
||||
audioSwitchCommand = "${
|
||||
(pkgs.extraLib.mkScript {
|
||||
name = "switch-audio";
|
||||
file = ./rofi/pulse-sink.sh;
|
||||
env = [
|
||||
pkgs.ponymix
|
||||
config.home-manager.users.${config.user}.programs.rofi.finalPackage
|
||||
];
|
||||
})
|
||||
}/bin/switch-audio";
|
||||
};
|
||||
|
||||
}
|
||||
|
15
modules/nixos/graphical/rofi/pulse-sink.sh
Executable file
15
modules/nixos/graphical/rofi/pulse-sink.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Credit: https://gist.github.com/Nervengift/844a597104631c36513c
|
||||
|
||||
sink=$(
|
||||
ponymix -t sink list |
|
||||
awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}' |
|
||||
rofi -dmenu -p 'pulseaudio sink:' -location 6 -width 100 |
|
||||
grep -Po '[0-9]+(?=:)'
|
||||
) &&
|
||||
ponymix set-default -d "$sink" &&
|
||||
for input in $(ponymix list -t sink-input | grep -Po '[0-9]+(?=:)'); do
|
||||
echo "$input -> $sink"
|
||||
ponymix -t sink-input -d "$input" move "$sink"
|
||||
done
|
Reference in New Issue
Block a user