Issues with using Bluetooth headset buttons to control media player

Hello everyone,

I have some issues with using Bluetooth headset buttons to control media player (like Play/Pause, go to the next/prev track, etc.) after switching from the nix 24.05 to 25.11. I suspect that it’s somehow related to the options sound.enable and sound.mediaKeys.enable as they were removed during the switch.

Config of the nix 24.05:

...
  services = {
    blueman.enable = true;

    pipewire = {
      enable = true;
      alsa.enable = true;
      alsa.support32Bit = true;
      pulse.enable = true;
    };
  };

  sound = {
    enable = true;
    mediaKeys.enable = true;
  };

  security.rtkit.enable = true;

  hardware = {
    bluetooth.enable = true;

    pulseaudio = {
      enable = false;
      package = pkgs.pulseaudioFull;
    };
  };

  systemd.user.services.mpris-proxy = {
    description = "Mpris proxy";
    after = [ "network.target" "sound.target" ];
    wantedBy = [ "default.target" ];
    serviceConfig = {
      Type = "simple";
      ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
    };
  };
...

Config of the nix 25.11:

...
  services = {
    blueman.enable = true;

    pipewire = {
      enable = true;
      alsa.enable = true;
      alsa.support32Bit = true;
      pulse.enable = true;
    };

    pulseaudio = {
      enable = false;
      package = pkgs.pulseaudioFull;
    };
  };

  security.rtkit.enable = true;

  hardware = {
    bluetooth.enable = true;
  };

  systemd.user.services.mpris-proxy = {
    description = "Mpris proxy";
    after = [ "network.target" "sound.target" ];
    wantedBy = [ "default.target" ];
    serviceConfig = {
      Type = "simple";
      ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
    };
  };
...

Like, they’re almost the same, except the mentioned sound options.

Hope someone can help resolve this problem.

Best regards,

I tried to debug something and got the following results on the working configuration:

First, I tried to monitor X events with xev:

  • Case 1: No apps are active. When I press the Start/Stop buttons on my headphones, I observe events like XF86AudioPlay and XF86AudioPause in the console.
  • Case 2: I play youtube in my browser. When I press the same buttons, I don’t observe the mentioned events in the console, but the broadcast actually starts/stops. So, most likely something grabs those events, and xev doesn’t see them, but I don’t know how to check it.

Then, I tried to check what’s going on the dbus with dbus-monitor, and every time I pressed the Start/Stop buttons I got something like:

method call time=1768116860.179364 sender=:1.0 -> destination=:1.46 serial=15 path=/org/mpris/MediaPlayer2; interface=org.mpris.MediaPlayer2.Player; member=Play
method return time=1768116860.180463 sender=:1.46 -> destination=:1.0 serial=161 reply_serial=15

OR

method call time=1768116871.348759 sender=:1.0 -> destination=:1.46 serial=16 path=/org/mpris/MediaPlayer2; interface=org.mpris.MediaPlayer2.Player; member=Pause
method return time=1768116871.349949 sender=:1.46 -> destination=:1.0 serial=168 reply_serial=16

Suggesting mpris is involved in all this somehow.

Later, I checked what’s going on the not working configuration and I got the following results:

The above “Case 2” works differently – the events are showed, meaning nothing grabs them anymore. Also, dbus-monitor shows nothing, meaning mpris doesn’t work anymore.