Media Keys not working with XFCE4

Hello guys!

As my title suggest it, I am runnng xfce4 and I am unable to change or play/stop songs using the media keys on my keyboard.

Thank you for your help!

Do you have pulseaudio enabled, and is there an applet in xfce’s panel?

1 Like

Yes, it is enabled. But I am also unable to get that pulseaudio into my xfce4-panel. I have installed the package but when I add it to the panel, it doesn’t show.

as you can see there below:

Which application are you using to play media?

I am using Spotify. It usually works with xfce on other distros.

I can reproduce the issue. It’s a problem in xfce4-pulseaudio-plugin.
Hopefully I can find some time to produce a fix :+1:

Edit: issue opened Media keys don't work with xfce4-pulseaudio-plugin in xfce · Issue #79839 · NixOS/nixpkgs · GitHub

1 Like

It’s volume also right?

No volume works well. Probably because I have another applet or application that takes over. Would you like that I create an issue in nixpkgs?

Out of the box with xfce.enable and pulseaudio I didn’t have volume keys working and what you mentioned here. Are you using xfce4-volumed-pulse also?

It seems that I don’t. At least not in my user environment. Give me a minute I will have a look to my system env!

EDIT: Nope I don’t have that plugin on my machine.

Ok, so I made a NixOS vm and with the config I mentioned volume up and down doesn’t actually work.
So I’m not sure why you have a different behavior (though it is actually broken though). Are you on 19.09?
Btw, I have the branch that I believe should fix we found for 20.03.

1 Like

I am running on nixos 19.09, indeed. So the fix should be backported to 19.09 at some point? or should I try to install the service from another version?

I forgot to mention this:

Are you using

services.xserver.desktopManager.xfce.enable

or

services.xserver.desktopManager.xfce4-14.enable

We have the “old” and “new” versions in 19.09.
But in 20.03 I made it so we only have one xfce that’s always the latest.

1 Like

I am using:

services.xserver.desktopManager.xfce.enable

I guess that I should go for 4-14 for now.

EDIT: I tried to downgrade and I end up not able to control the volume as well as not being able to change songs on spotify.

When you say “I tried to downgrade and I end up not able to control the volume as well as not being able to change songs on spotify.” you mean you switched to use 4-14? Because that’s an upgrade.

Yes, I switched to 4-14. Oh that was the upgraded version? ah ok, my bad I thought it was a downgrade obviously. No still didn’t work. But pulseaudio was showing in my panel.

Here’s the diff between using xfce for volume stuff

old xfce

++ (if config.hardware.pulseaudio.enable
          then [ xfce4-mixer-pulse xfce4-volumed-pulse ]
          else [ xfce4-mixer xfce4-volumed ])

xfce 4.14

++ optionals config.hardware.pulseaudio.enable [
        pavucontrol
        # volume up/down keys support:
        # xfce4-pulseaudio-plugin includes all the functionalities of xfce4-volumed-pulse
        # but can only be used with xfce4-panel, so for no-desktop usage we still include
        # xfce4-volumed-pulse
        (if cfg.noDesktop then xfce4-volumed-pulse else xfce4-pulseaudio-plugin)
      ] 

So before you were using xfce4-mixer-pulse (defunct) and xfce-volumed-pulse.

The bug I found was in xfce4-14 with just xfce4-pulseaudio-plugin.
This is why I was very particular about not having two xfce versions :rofl:
Rather confusing.

Anyways, here’s the change that I hope fixes this for the supported xfce version
https://github.com/NixOS/nixpkgs/pull/79844

re withdrawn post

I didn’t consider it could be an issue with xfce4-volumed-pulse.
Will check that.

1 Like

I tested it! This feature now works great! Sorry for the time it took for me to back here to set it as the solution. I had to go to i3 for the meantime, cause it was irritating me too much :stuck_out_tongue:

Thank you @worldofpeace

1 Like