Picture of Jürgen Kreileder

Archive for the ‘GNOME’ Category

Last.fm for Rhythmbox – New Style

Just like a lot of other users I like to scrobble my played tracks to last.fm. Unfortunately Rhythmbox provides no way to love a track. The last.fm plug-ins for Windows and OS X have been modified to scrobble through the last.fm client some time ago but the Rhythmbox plug-in still submits directly. That is until now…

Rhythmbox and lastfm

I have written a new last.fm plug-in for Rhythmbox today. Instead of scrobbling directly like the old one, it submits tracks via the lastfm client application. The client displays additional information about the currently playing song and you can love and tag the song with it.

The source code is available as a patch against Rhythmbox 2.90.1 (git snapshot 20120108): scrobbler-v3t.patch
You can apply this patch with:

patch -NEp1 < ~/scrobbler-v3t.patch

Ubuntu Oneiric Ocelot users can get precompiled packages from my APT repositories by running these commands in a terminal:

$ sudo add-apt-repository \
    'http://blackdown.de/static/debian/rhythmbox/ main'
$ wget https://blackdown.de/static/gpg.asc -O - | \
    sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install rhythmbox rhythmbox-plugins lastfm

To enable the new plug-in go to Edit » Plugins. Disable the “Last.fm” plug-in and enable the “New Style Last.fm Scrobbler”.
If you enable this scrobbler plug-in, you have to disable the old Last.fm plug-in! Otherwise you will have two plug-ins which will both submit to last.fm at the same time. Only use one at a time!

Note that this first version of the plug-in does not start the lastfm client automatically! It will scrobble only if you start the client manually. I will fix this in the next version.

Feedback, postive as well as negative, is very welcome. If you want to report a bug, please include the output of “rhythmbox -D rb-scrobbler-plugin” and the tags of the song you wanted to scrobble.
If you want to report a crash, providing a gdb backtrace would be nice.

You might also want to take a look at this thread on the last.fm development forum.

May 20th, 2007: v2 of the plug-in is available now. lastfm gets launched automatically now.
May 22nd, 2007: v3 is available. The patch and the Ubuntu package have been updated: Changes since v2
May 25th, 2007: v3a: Updated patch and deb for the new Ubuntu Gutsy version of Rhythmbox.
May 29th, 2007: v3b: Updated patch and deb for the new Rhythmbox release.
May 31st, 2007: Updated patch Ubuntu package.
June 1st, 2007: Added APT repositories for Ubuntu Feisty and Gutsy.
June 28th, 2007: v3c: Updated patch and debs for the new Rhythmbox release.
August 16th, 2007: v3d: Updated patch and debs for Rhythmbox 0.11.2.
November 14th, 2007: v3e: Updated patch and debs for Rhythmbox 0.11.3. Add Hardy repository.
November 30th, 2007:Updated gusty and hardy builds. Include fixed Croatian po file from Franko Burolo.
February 7th, 2008: v3f: Updated patch and debs for Rhythmbox 0.11.4. (Thanks to Iain Buchanan for notifying me of the missing patch!)
May 31st, 2008: v3g: Updated patch to apply cleanly to Rhythmbox 0.11.5. (The debs for hardy have been at 0.11.5 for quite a while).
October 15st, 2008: v3h: Updated patch to apply cleanly to Rhythmbox 0.11.6. Ubuntu packages are available for i386, amd64, and lpia now.
October 20st, 2008: v3i: Updated patch to apply cleanly to the real Rhythmbox 0.11.6 release. v3h was for a later version from SVN.
April 24th, 2009: v3j: Update patch to apply cleanly to Rhythmbox 0.12.0. Provide debs for Ubuntu Jaunty.
November 4th, 2009: v3k: Update patch to apply cleanly to Rhythmbox 0.12.5 and provide debs for Ubuntu Karmic.
November 29th, 2009: v3l: Update patch to apply cleanly to Rhythmbox 0.12.6 and provide debs for Ubuntu Lucid too.
April 25th, 2010: v3m: Update patch to apply cleanly to Rhythmbox 0.12.8. Provide debs for Ubuntu Lucid.
Jun 3rd, 2010: v3n: Update patch to apply cleanly to Rhythmbox 0.12.8git20100602. Provide debs for Ubuntu Maverick Meerkat 10.10.
Jun 13th, 2010: v3o: Update patch to apply cleanly to Rhythmbox 0.12.8git20100611. Updated debs for Ubuntu Maverick Meerkat 10.10.
October 10th, 2010: v3p: Update patch to apply cleanly to Rhythmbox 0.13.1. Provide updated debs for Ubuntu Maverick Meerkat 10.10.
April 4th, 2011: v3p: Update patch to apply cleanly to Rhythmbox 0.13.3. Provide debs for Ubuntu Natty Narwhal 11.04.
October 16th, 2011: v3r: Updated patch for new plug-in infrastructure in Rhythmbox 2.90.1. Provide debs for Ubuntu Oneiric Ocelot 11.10.
December 23rd, 2011: v3s: Updated patch. Provide debs for Ubuntu Precise Pangolin 12.04.
January 14th, 2012: v3t: Update patch and debs for Ubuntu Precise.

Updated Logitech MX1000 Configuration

XOrg 6.9 and later come with a new evdev driver. Configurations using the old evdev protocol hack no longer work. So here’s an updated version of my old MX1000 configuration:

  • Build a udev rule to give the mouse device a static name: I’m using
    ACTION=="add", \
      KERNEL=="event*", \
      SUBSYSTEM=="input", \
      SYSFS{manufacturer}=="Logitech", \
      SYSFS{product}=="USB Receiver", \
      NAME="input/mx1000"

    in /etc/udev/rules.d/010_local.rules.
    After restarting udev and replugging the mouse, you should see a device named /dev/input/mx1000.

  • /etc/X11/xorg.conf:
    Section "InputDevice"
     Identifier "MX1000"
     Driver     "evdev"
     Option     "CorePointer"
     Option     "Device"    "/dev/input/mx1000"
    EndSection
  • ~/.xbindkeysrc:
    (You have to install xbindkeys and xvkbd for this; I’m starting xbindkeys in ~/.gnomerc)

    # Backward and Forward buttons
    "xvkbd -text "\[Alt_L]\[Left]""
      m:0x10 + b:8
    "xvkbd -text "\[Alt_L]\[Right]""
      m:0x10 + b:9
    
    # "Cruise Control" disabled:
    #"xvkbd -text "\[Page_Up]""
    #  m:0x10 + b:11
    #"xvkbd -text "\[Page_Down]""
    #  m:0x10 + b:12
    
    # "Cruise Control" enabled:
    # Work-around extra events
    "~/bin/click 4"
     m:0x10 + b:11
    "~/bin/click 5"
     m:0x10 + b:12
    
    # Application-Switch button
    # A-Tab doesn't work
    # Use it as another Forward for now
    "xvkbd -text "\[Alt_L]\[Right]""
      m:0x10 + b:10

    Using the Application-Switch button for switching windows in GNOME doesn’t work because it would require holding down the Alt key while pressing Tab several times, xvkbd can’t do that. I’m using the button as another Forward now, it’s easier to reach than the real Forward button.
    Defining actions for the Cruise Control buttons only makes sense when Cruise Control is disabled (you can disable it with lmctl or the Logitech Mouse Applet). If it is disabled, the buttons generate 11 and 12. When it is enabled, they generate a single button 11 or 12 event and then a series of button 4 or 5 events just like scrolling the wheel does.
    I have no idea why the mouse generates 11 or 12 before starting normal scrolling in Cruise Control mode. I’m mapping 11 and 12 to a little utility (click by Jeremy Nickurak) which replaces these bogus events with normal scroll events.

  • At this point the Backward and Forward buttons should work in GNOME, KDE, and -based browsers. Horizontal scrolling should work in GNOME and KDE.
    Mozilla-based browser like need two additional changes to get horizontal scrolling working with the tilt wheel: Open about:config and set

    mousewheel.horizscroll.withnokey.action = 0
    mousewheel.horizscroll.withnokey.sysnumlines = true

January 18th, 2006: The evdev driver in XOrg 6.9 is broken on big-endian machines like powerpc. Here’s a fix.

Logitech MX1000 Configuration

I’ve had to buy a new mouse, this time I got me a Logitech MX1000 (my first Logitech mouse ever). The Microsoft IntelliMouse Explorer I’ve used on my G5 got broken, it lost about two out of ten of clicks on the left button.

I’m not completely satisfied with the MX1000. It’s too heavy and a bit too small for my hands. The notable exception is the Forward button, it’s too far away from my thumb. I’ve had the last problem with the IntelliMouse Explorer too. I still have a few IntelliMouse Optical on other machines, I really like that mouse. Perfect Size, good wheel, easily reachable side buttons. The only drawback is the annoying big red light.

Anyhow, back to the MX1000. Only a few changes to my configuration for the IntelliMouse Explorer where needed to get it working. Here’s my new configuration:

  • /etc/X11/XF86Config-4 or /etc/X11/xorg.conf:
    Section "InputDevice"
     Identifier "MX1000"
     Driver     "mouse"
     Option     "CorePointer"
     Option     "Protocol"        "evdev"
     Option     "Dev Name"        "Logitech USB Receiver"
     Option     "Buttons"         "12"
     Option     "ZAxisMapping"    "11 12 10 9"
     Option     "Resolution"      "800"
     Option     "Emulate3Buttons" "false"
    EndSection
  • /etc/X11/Xmodmap:
    ! MX1000
    pointer = 1 2 3 8 9 10 11 12 6 7 4 5

    This gets the buttons in right order: Scrolling the wheel generates 4 and 5, tilting the wheel 6 and 7.

  • ~/.xbindkeysrc:
    (You have to install xbindkeys and xvkbd for this; I’m starting xbindkeys in ~/.gnomerc)

    # Backward and Forward buttons
    "xvkbd -text "\[Alt_L]\[Left]""
      m:0x10 + b:8
    "xvkbd -text "\[Alt_L]\[Right]""
      m:0x10 + b:9
    
    # "Cruise Control" disabled:
    #"xvkbd -text "\[Page_Up]""
    #  m:0x10 + b:11
    #"xvkbd -text "\[Page_Down]""
    #  m:0x10 + b:12
    
    # "Cruise Control" enabled:
    # Only use this if you have problems with Mozilla
    #"NoCommand"
    #  m:0x10 + b:11
    #"NoCommand"
    #  m:0x10 + b:12
    
    # Application-Switch button
    # A-Tab doesn't work
    # Use it as another Forward for now
    "xvkbd -text "\[Alt_L]\[Right]""
      m:0x10 + b:10

    Using the Application-Switch button for switching windows in GNOME doesn’t work because it would require holding down the Alt key while pressing Tab several times, xvkbd can’t do that. I’m using the button as another Forward now, it’s easier to reach than the real Forward button.
    Defining actions for the Cruise Control buttons only makes sense when Cruise Control is disabled (you can disable it with the Logitech Mouse Applet). If it is disabled, the buttons generate 11 and 12. When it is enabled, they generate a single button 11 or 12 event and then a series of button 4 or 5 events just like scrolling the wheel does.
    I have no idea why the mouse generates 11 or 12 before starting normal scrolling in Cruise Control mode. I’m mapping 11 and 12 to “NoCommand”, this eliminates the ButtonPress but not the ButtonRelease event. This seems to eliminate the negative effects of the extra button events in Mozilla. (Mozilla interprets the 11 and 12 events as normal left clicks, Firefox doesn’t have this issue. So if you’re using Firefox or if you don’t see the left-click problem with your Mozilla build, then don’t bind 11 and 12 to anything.)

  • At this point the Backward and Forward buttons should work in GNOME, KDE, and -based browsers. Horizontal scrolling should work in GNOME and KDE.
    Mozilla-based browser like need two additional changes to get horizontal scrolling working with the tilt wheel: Open about:config and set

    mousewheel.horizscroll.withnokey.action = 0
    mousewheel.horizscroll.withnokey.sysnumlines = true

April 5th, 2005: Update: Don’t bind 11/12 to anything in Cruise Control mode by default (only needed if there are problems with Mozilla). Fixed the "Cruise Control" comments in ~/.xbindkeysrc.

January 15th, 2006: Xorg 6.9 and later come with a different evdev driver. I’ve made an updated version of this guide now.

Tilt Wheel Mouse

Now that I finally got the kernel’s evdev driver running on my machine, I managed to get my tilt-wheel mouse working.

  • Mouse section from /etc/X11/XF86Config-4:

    Section "InputDevice"
      Identifier "Configured Mouse"
      Driver     "mouse"
      Option     "CorePointer"
      Option     "Protocol"        "evdev"
      Option     "Dev Name"        "*Microsoft IntelliMouse*"
      Option     "Buttons"         "9"
      Option     "ZAxisMapping"    "8 9 6 7"
      Option     "Emulate3Buttons" "false"
    EndSection
  • To get the buttons in the correct order for X11, change /etc/X11/Xmodmap to:

    pointer = 1 2 3 8 9 7 6 4 5

    Now horizontal scrolling should work with GNOME!

  • In Mozilla-based browsers however, tilting the wheel moves back- or forward in the history now. To fix this open about:config and set mousewheel.horizscroll.withnokey.action to 0.
    Unfortunately Mozilla and GNOME seem to have different interpretations of left and right; set mousewheel.horizscroll.withnokey.sysnumlines to true to fix that.
  • To get the sides buttons going back- and forward in history again, install xbindkeys and xvkbd. Bind the buttons to Alt-Left and Alt-Right in ~/.xbindkeysrc:

    "xvkbd -text "\[Alt_L]\[Left]""
      m:0x10 + b:8
    "xvkbd -text "\[Alt_L]\[Right]""
      m:0x10 + b:9

    and run xbindkeys in ~/.gnomerc

January 15th, 2006: Xorg 6.9 and later come with a different evdev driver. I’ve made a new guide now. The new guide talks about the Logitech MX1000 but it’s quite easy to adapt the configuartion for other mice.