Xmonad and media keys on Saucy
October 27, 2013Ubuntu continues on its rampage of breaking perfectly good software, and on my most recent upgrade to Saucy Salamander, I discovered to my dismay that my media keys (e.g. volume keys, fn (function) keys, suspend button, etc) had stopped working. Of course, it worked fine if I logged into my user using Unity, but who wants to use a silly window manager like that…
The root problem, according to these Arch Linux forum posts is that Gnome has moved media-key support out of gnome-settings-daemon (which any self-respecting Xmonad user is sure to spawn) and into their window manager proper. Which, of course, is no good because I don’t want to use their window manager!
For now, it seems the simplest method of bringing back this functionality is to run a 3.6 version of gnome-settings-daemon. Fortunately, at least for Saucy, there are a few builds of 3.6 available before they upgraded to 3.8. So, all you need to do is grab these two deb files appropriate for your architecture (you need gnome-control-center too, because it has a dependency on gnome-settings-daemon):
Once you’ve downloaded the appropriate deb files, a dpkg -i $DEBFILE and then apt-mark hold gnome-control-center gnome-settings-daemon should do the trick. You should run an aptitude upgrade to make sure you haven’t broken any other dependencies (for example, gnome-shell). (Power-users can add the debs to a local repo and then downgrade explicitly from apt-get.)
Moving forward, we will probably be forced to reimplement media key bindings in some other software package, and it would be nice if this could be standardized in some way. Linux Mint has already forked gnome-settings-daemon, with their cinnamon-settings-daemon, but I’ve not tried it, and have no idea how well it works.
Update. Trusty has an updated version of this package which restores support, so I am providing backports via my PPA.
haskell planet feedback. why are U using Ubuntu or ‘garbage software’ and NOT FreeBSD?
the tests 1.)closed 2.)developer code review 3.)much too widespread and bloated - debian 4.)code copying and code smells 5.)
Well, it’s not a case where the problem is “patchable.” Gnome has specifically decided that the functionality does not belong in gnome-session-daemon. I should probably file a feature request though.
gnome-panel is a way to get things to work, but there’s no way to run gnome-panel, without the panel, if you know what I mean ;)
Meh, gnome-settings-daemon requires all kinds of bloated gnome stuff to be installed as dependencies. I map my volume keys to amixer using xbindkeys and once it was set up I’ve never had to tweak it.
Maybe “x-settings-daemon” will do what you want?
Try the trusty version of gnome-settings-daemon. It sounds like it fixes exactly your problem.
It should be updated in 13.10 soon, too
gnome-settings-daemon (3.8.5-0ubuntu12) trusty; urgency=low * debian/patches/fix_media_keys_on_unity.patch: Another reworking. Try to start the legacy keygrabber all the time. Only don't if we're running shell. Should fix keygrabber in environments without panel or Unity. -- Iain Lane Tue, 29 Oct 2013 17:03:35 +0000 Oh sweet!
I just upgraded to 13.10. However the fn keys are still working for me. It might be because I login with “Xmonad with Gnome” in the login screen.
Oh, and thanks for this amazing blog! Never stop posting! :)
Nevermind. I realized it was just
gnome-panelmaking the keys working.Tough, I just realized that if you launch
gnome-paneland thentaffybar(in that order). You’ll be runninggnome-panelwithout the actual panel! :)This no longer seems to work:
dpkg: dependency problems prevent configuration of gnome-settings-daemon: gnome-settings-daemon depends on libgnome-desktop-3-4 (>= 3.5.3); however: Package libgnome-desktop-3-4 is not installed.
Actually, it’s not needed any more. After posting that I discovered that there was a version of gnome-settings in saucy-proposed that fixes it.
https://bugs.launchpad.net/ubuntu/saucy/+source/gnome-settings-daemon/+bug/1235625
Hopefully it’ll get released properly soon.
After some futzing around, here’s an awkward workaround that gets media keys working (using stock packages from Ubuntu vivid):
add gnome-settings-daemon to RequiredComponents in xmonad.session after login, run gnome-panel after login, run “unity-settings-daemon –replace”
It seems that the combination of gnome-panel and unity-settings-daemon are necessary to handle media keys, and furthermore, for some reason adding unity-settings-daemon to RequiredComponents does not properly launch unity-settings-daemon.
Wow, I’ve been searching for ages to figure this out (I’m using i3 as a window manager) and yes, running gnome-panel makes everything work.
It’d be awesome if anyone could figure out how to have it working without splatting gnome headers/footers to the screen :-)
Further update, I’ve worked out (since I run a nested X server for some selenium stuff I do) I can run gnome-panel in there (using DISPLAY=:1 gnome-panel &), then the stupid top/bottom bars are out of sight, and global media keys still works.
Seriously, that’s very ugly though, hopefully someone can improve on that :-)
Oh, i3 has a doofer that renders tray icons for you … I wonder if gnome panel is eating them though, might have to check that tomorrow :-)
Either way, it’d be nice if I didn’t have to run gnome-panel at all …
Looked into this a bit while I should have been working on something more productive, and it looks like all gnome-panel was doing to cause this to work was requesting the name (whatever that means) “org.gnome.Panel” on the “org.freedesktop.DBus” interface. Of course.
So I hacked together a script that does that and then goes to sleep: https://gist.github.com/msullivan/d3bca6ed2907ee5d8d16
I could probably package this up more nicely if that would be useful to people.