refactor(audio): simplify media controls #169
@@ -6,37 +6,33 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
# PipeWire as the desktop audio server.
|
# PipeWire as the desktop audio server.
|
||||||
|
let
|
||||||
|
mediaKey = keys: command: {
|
||||||
|
inherit keys;
|
||||||
|
locked = true;
|
||||||
|
action = {
|
||||||
|
kind = "exec";
|
||||||
|
command = "${lib.getExe pkgs.playerctl} ${command}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
options.modules.desktop.utilities.audio.enable = lib.mkEnableOption "the PipeWire audio server";
|
options.modules.desktop.utilities.audio.enable = lib.mkEnableOption "the PipeWire audio server";
|
||||||
|
|
||||||
config = lib.mkIf config.modules.desktop.utilities.audio.enable {
|
config = lib.mkIf config.modules.desktop.utilities.audio.enable {
|
||||||
|
# Realtime scheduling for the audio threads, so playback survives load.
|
||||||
|
security.rtkit.enable = true;
|
||||||
|
|
||||||
|
services.pipewire = {
|
||||||
|
enable = true;
|
||||||
|
alsa.enable = true;
|
||||||
|
pulse.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
registry.keybind.${config.networking.hostName} = {
|
registry.keybind.${config.networking.hostName} = {
|
||||||
media-play = {
|
media-play = mediaKey "XF86AudioPlay" "play-pause";
|
||||||
keys = "XF86AudioPlay";
|
media-next = mediaKey "XF86AudioNext" "next";
|
||||||
locked = true;
|
media-previous = mediaKey "XF86AudioPrev" "previous";
|
||||||
action = {
|
|
||||||
kind = "exec";
|
|
||||||
command = "${lib.getExe pkgs.playerctl} play-pause";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
media-next = {
|
|
||||||
keys = "XF86AudioNext";
|
|
||||||
locked = true;
|
|
||||||
action = {
|
|
||||||
kind = "exec";
|
|
||||||
command = "${lib.getExe pkgs.playerctl} next";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
media-previous = {
|
|
||||||
keys = "XF86AudioPrev";
|
|
||||||
locked = true;
|
|
||||||
action = {
|
|
||||||
kind = "exec";
|
|
||||||
command = "${lib.getExe pkgs.playerctl} previous";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
registry.waybar.${config.networking.hostName} = {
|
registry.waybar.${config.networking.hostName} = {
|
||||||
@@ -66,14 +62,5 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Realtime scheduling for the audio threads, so playback survives load.
|
|
||||||
security.rtkit.enable = true;
|
|
||||||
|
|
||||||
services.pipewire = {
|
|
||||||
enable = true;
|
|
||||||
alsa.enable = true;
|
|
||||||
pulse.enable = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user