refactor(audio): simplify media controls

This commit was merged in pull request #169.
This commit is contained in:
2026-10-11 21:22:38 -04:00
parent ee29e53f7c
commit 1d5acc09c6

View File

@@ -6,37 +6,33 @@
...
}:
# 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";
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} = {
media-play = {
keys = "XF86AudioPlay";
locked = true;
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";
};
};
media-play = mediaKey "XF86AudioPlay" "play-pause";
media-next = mediaKey "XF86AudioNext" "next";
media-previous = mediaKey "XF86AudioPrev" "previous";
};
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;
};
};
}