Monday, November 28, 2011

Use multimedia keys with gmusicbrowser

gmusicbrowser is the default music player for Xubuntu 11.10. Among its main features are the support for large libraries, customizable window layouts, a powerful browser which doesn't interfere with the playlist and a tray icon with player controls.

There is a plugin called "Gnome mmkeys" that allows to control playback with keyboard's multimedia keys, albeit not compatible with Xfce4. If you try to enable the plugin, the message below will be shown:

Error: org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SettingsDaemon was not provided by any .service files

So I created a little bash script to control the gmusicbrowser playback and another one for assigning each function with the correspondent multimedia key.

Install

Open a terminal window and run (it'll need admin permissions for installing gmusicbrowser-mmkeys.sh to /usr/local/bin/):

wget -q -O /tmp/gmb.sh https://goo.gl/18uaAO && bash /tmp/gmb.sh install

The multimedia keys should now be working. Enjoy.

Uninstall

Open a terminal window and run (it'll ask for admin permissions for removing the gmusicbrowser-mmkeys.sh script):

gmusicbrowser-mmkeys.sh uninstall

Note: The installer has been updated to install gmusicbrowser-mmkeys.sh in /usr/local/bin. If you install it elsewhere, please remove manually.

References

gmusicbrowser man page (oneiric)
Xfce Settings (xfconf-query reference)

30 comments:

  1. I prefer to use exaile. It is far more practical and beautiful.

    ReplyDelete
    Replies
    1. Actually exaile is my second favorite player. Now I'm using clementine (http://goo.gl/jOSiJ) a fork of the good old Amarok 1.4.

      Delete
  2. Nice hack, Wilson, this was ever so useful! :-)

    ReplyDelete
  3. Muchas gracias!!!

    ReplyDelete
  4. That is perfect. Nice and clean :-)

    ReplyDelete
  5. Replies
    1. I updated the article to include a section explaining how to uninstall the script. If you mean remove gmusicbrowser, run this:

      sudo apt-get remove gmusicbrowser -y

      If you're looking for a new music player, you could take a look at Clementine: http://goo.gl/0HOxU. Now it's my first choice.

      Delete
  6. I removed gmusicbrowser-mmkeys.sh and change keys to default. Im now using clementine as you suggested and it's a great player. The only problem i found so far is that it cannot load audio cd. If you know how to fix it i will really apreciate it. Im now a follower of your blog! I also installed synapse.
    I tried a lot of gnome 3 distros/forks and i gave up. I was about to try MATE when i came across your blog and decided to install xubuntu. So far it works flawless!
    Thanks very much and i look forward to read more news!
    (if i sound a little weird is because im from Argentina and spanish is my first language).

    ReplyDelete
    Replies
    1. Hi, I'm glad you found this blog useful. Some time ago I was also unsatisfied with the other options (Unity, Gnome 3, KDE 4, ...), until I tried Xubuntu.

      The PC I'm using doesn't have a CD player, so I'll take a look at your problem later.

      Don't worry worry about your English, I understood it just fine. And English isn't my mother tongue either, I'm Portuguese.

      Delete
    2. Finally I got a chance of trying to play a CD with Clementine (Music > Open audio CD). I didn't experience any problems. I'm using version 1.0.1 installed from the 12.10 repositories.

      Delete
  7. nicely done... keys working again! thanks!

    ReplyDelete
  8. Thanks for providing such a great article, it was excellent and very informative.
    as a first time visitor to your blog I am very impressed.
    thank you :)

    ReplyDelete
  9. In Xubuntu 13.04 I was able to control both Spotify and gmusicbrowser separately (fn play/pause keys would only play/pause gmusicbrowser when it is open and not autostart it if it wasn't open by the user via the keyboard shortcuts method described above) by using the Gnome mmkeys plugin. If you go to "Session and Startup" -> "Application Autostart" and check the box next to "Gnome Settins Daemon" and then log in and log out, you should be able to use the mmkeys plugin. This frees up the shortcut keys so that they can be used for other applications and not only gmusicbrowser. Thanks OP for your original quick and easy solution which helped me think of mine. If anyone is looking to control other applications as well, I can vouch that at least Spotify and gmusicbrowser work together.

    Regards,
    -M

    ReplyDelete
    Replies
    1. Also OP, please feel free to include my findings in your post if you feel it will be helpful to future visitors.

      -M

      Delete
  10. Can you make something like this for clementine also?

    ReplyDelete
    Replies
    1. Clementine has built-in support for multimedia keys. However the default system package doesn't work very well. Try to install the development version as described on this post: http://goo.gl/FDisvK

      Delete
  11. Thanks! great hack

    ReplyDelete
  12. Thanks so much, man..
    Worked on Debian Wheezy 7.7!

    ReplyDelete
  13. Nice man, you saved my day...

    ReplyDelete
  14. 404. That’s an error.
    The requested URL /svn/trunk/gmusicbrowser/install-gmusicbrowser-mmkeys.sh was not found on this server.

    Could you please re-upload the script? Thanks

    ReplyDelete
    Replies
    1. Just re-uploaded the script and updated the install instructions.

      Delete