diff --git a/modules/home/niri/config.kdl b/modules/home/niri/config.kdl index f657fd1..f70a779 100644 --- a/modules/home/niri/config.kdl +++ b/modules/home/niri/config.kdl @@ -359,12 +359,16 @@ binds { XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; } XF86AudioMicMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; } - // Example media keys mapping using playerctl. - // This will work with any MPRIS-enabled media player. - XF86AudioPlay allow-when-locked=true { spawn-sh "playerctl play-pause"; } - XF86AudioStop allow-when-locked=true { spawn-sh "playerctl stop"; } - XF86AudioPrev allow-when-locked=true { spawn-sh "playerctl previous"; } - XF86AudioNext allow-when-locked=true { spawn-sh "playerctl next"; } + // Route through DMS's `mpris` IPC target instead of bare `playerctl`. + // DMS tracks its own `activePlayer` (last-active/non-idle heuristic, + // see MprisController.qml) independently of whatever MPRIS reports as + // "current" — with multiple players running (browser tabs, Spotify, + // etc.) the two disagree and bare playerctl toggles the wrong stream. + XF86AudioPlay allow-when-locked=true { spawn "dms" "ipc" "call" "mpris" "playPause"; } + XF86AudioPause allow-when-locked=true { spawn "dms" "ipc" "call" "mpris" "playPause"; } + XF86AudioStop allow-when-locked=true { spawn "dms" "ipc" "call" "mpris" "stop"; } + XF86AudioPrev allow-when-locked=true { spawn "dms" "ipc" "call" "mpris" "previous"; } + XF86AudioNext allow-when-locked=true { spawn "dms" "ipc" "call" "mpris" "next"; } // Example brightness key mappings for brightnessctl. // You can use regular spawn with multiple arguments too (to avoid going through "sh"), diff --git a/modules/home/niri/default.nix b/modules/home/niri/default.nix index 6fe14d8..ebb314c 100644 --- a/modules/home/niri/default.nix +++ b/modules/home/niri/default.nix @@ -136,7 +136,6 @@ include "dms-input.kdl" pkgs.xwayland-satellite pkgs.wl-clipboard pkgs.brightnessctl - pkgs.playerctl pkgs.swayidle ];