Rhythmbox from the command line

So I was playing around with my conky config and I thought it’d be cool to be able to see my “now playing” song from it. Conky has some built in bits for that kind of thing in mpd but that’s no use to me since I use rhythmbox to listen to my music. A bit of googling around came up with some hits on using dbus-send to find the info [1,2] but the output was a little more raw than I was hoping for. While I was have a brief look through the rhythmbox manpage I noticed down the bottom of the page:


SEE ALSO
rhythmbox-client(1).

Aaah, how handy ๐Ÿ˜€ So issuing a rhythmbox-client --print-playing gives me this (the last line of the screenshot):

rhythmbox-client and conky now playing screenshot

rhythmbox-client can also handly play/pause, stop, next, previous, skip, add songs to the queue and other stuff to rhythmbox, all from the command line. In my .conkyrc I put the following line to give the “Now Playing” output:

${color #5b6dad}Now Playing: ${color}${exec /usr/bin/rhythmbox-client --print-playing}

12 thoughts on “Rhythmbox from the command line”

  1. Thanks that was useful.

    I found that if I used your line then rhythmbox would open if it wasn’t already, which I didn’t really want. Mine looks like this now. This gives the album title on a line below too:
    Now Playing:
    ${exec /usr/bin/rhythmbox-client –no-start –no-present –print-playing-format “%ta – %tt”}
    ${exec /usr/bin/rhythmbox-client –no-start –no-present –print-playing-format “%at”}

  2. Ah nice one Adam. I did notice that too but since I always have it running, I didn’t bother doing anything about it. Thanks for the tip!

  3. Thats the reason why I never started working with Linux. Itยดs takes to long time, to install every software from the command line, put my wlan to work and other stuff.. XP runs for me much faster, in the way for installing something, drivers, etc.

  4. Jeje maybe Linux is just not for you.

    The conversation here is on how to have the Rhythmbox player information show on the desktop. There is just no way to do something like that on a Windows system. Yes, it takes some command line magic to make this work. It IS possible to do this with Linux, it is NOT possible to do it with Windows.

    Maybe you have not installed Linux recently. The average person can now install Linux and have more eye candy than windows, without ever touching the command line. If you want more apps, it is even easier than in Windows, just pick off a list what you want and it is installed.

    Of course if you know the command line you can always do something like

    apt-get install flashplayer-nonfree rhythmbox openssh-server x11vnc

    and in one shot install all the software that does not come with a default install.

  5. I have a tight space for my conky so I just want the first 22 bytes of the song title followed by ellipses. Also I check first to see if rhythmbox is active. Cheers.

    ${if_running rhythmbox}${color #A7D7BB}${exec /usr/bin/rhythmbox-client –no-start –no-present –print-playing|cut -b -22}…$endif

  6. Thanks for your tips but I don’t know if I will use them right away. This stuff seems to be way over my head! But we all appreciate you sharing freely what you know.

  7. Thanks ๐Ÿ˜€
    Anyway to check if rhythmbox is running? E.g. I want to hide “now playing” when rhythmbox is closed.

  8. You can also use this script

    #!/bin/bash

    playing=`rhythmbox-client –no-start –print-playing`

    if [ -n “$playing” ]
    then
    echo $playing
    else
    echo “Not playing”
    fi

    and use execi to execute that script. It doesn’t really add functionality, it basically just gives output without having to have rhythmbox on. It looks prettier if you’re not the kind of person who always has rhythmbox on.

Comments are closed.