4

The Ubuntu sound indicator is nice because you can pause the playing song, go next or previous. Is there a way to add a scrollable time bar to that interface for the playing song?

I got the idea from a mockup in DeviantArt

enter image description here


EDIT 1

I think it's possible. I found this screen shot here even though it's from 2010 :-)

enter image description here


EDIT 2

I would like a global solution not just for rhythmbox like shown in the screenshot above. A global solution means that it can be used for controlling the current playing song irrespective of the media player used, be it VLC, Banshee, Rhythmbox, Audacious etc.


EDIT 3

Since a global solution is kinda impractical (see comments below), how about for VLC only? It's practically the only media player I use.

  • 1
    this link might be of help askubuntu.com/questions/181508/… – kenn Mar 18 '14 at 14:39
  • Which Ubuntu version you are targeting? indicator-sound has got much code changes. – user.dz Mar 19 '14 at 10:23
  • 1
    @Sneetsher I'm using Ubuntu 12.04. If you get a working version for 13.10 too, it would be nice. – Parto Mar 19 '14 at 11:03
  • @AvatarParto VLC and some others media players doesn't appear ever in the sound indicator menu, so I'm almost sure that there doesn't exists a global solution for controlling the current playing song irrespective of the media player used. – Radu Rădeanu Mar 22 '14 at 15:49
  • @RaduRădeanu How about for VLC only. It's the only player I use like 90% of the time? – Parto Mar 22 '14 at 22:24
0

You'll have to change the source code for indicator-sound.

However, I came up with a hack based on this question.

(For VLC)

First of all, to add VLC to the sound indicator, you have to enable the MPRIS Dbus interface. (Follow this link for more detailed explanation.) Once you have enabled it, VLC (along with other Music Players) can be controlled via D-bus interface.

For example, for VLC you can run the following command from terminal to seek 10s forward.

qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Seek 10000000

You can read all the available functions from the MPRIS interface here.

Now based on this question, you can create your own custom script to seek 10s forward, backward etc.

  • Thanks for the suggestions but seeing you have 3k reputation, allow me to give the 50 to @Vivek atleast to raise his abit. Atleast you guys tried to find a solution though it didn't work out. – Parto Mar 26 '14 at 6:39
0
+50

For Gnome-Shell users (not Unity)

You can use gnome-shell-extensions-mediaplayer.

sudo add-apt-repository ppa:webupd8team/gnome3
sudo apt-get update
sudo apt-get install gnome-shell-extensions-mediaplayer

Please go through below link, you can customize many things:

https://github.com/eonpatapon/gnome-shell-extensions-mediaplayer/blob/master/README.md

  • Looks Nice but sorry I'm using unity. – Parto Mar 25 '14 at 14:46
  • oops!...but I guess it can give idea how to implement same thing in unity. – Vivek Mar 25 '14 at 16:18
  • The reputation is because you at least tried to find a solution for me. I won't mark it as answered though. – Parto Mar 26 '14 at 6:40
  • 1
    Thanks I found the question interesting...now I am trying to implement it in unity :).. I found this link interesting: wiki.ubuntu.com/DesktopExperienceTeam/… – Vivek Mar 26 '14 at 8:21
0

I have created a custom Application indicator with 3 menu items viz. Rewind, Forward & Quit. I have tested it in unity it works fine. It can give you some idea. I am trying to make it look like picture provided by you. Meanwhile I am posting the code that I am using you can work on that too.

Requirement: mdbus2

Install it using: sudo apt-get install mdbus2

Below is the python code:

#!/usr/bin/env python
'''
To rewind and forward the currently playing song
depend on mbus2 and can be installed using sudo apt-get install mbus2
version 0.1 (public domain)

Author: Vivek Mishra
'''

import dbus
bus = dbus.SessionBus()
proxy = bus.get_object('org.mpris.MediaPlayer2.rhythmbox','/org/mpris/MediaPlayer2')
player = dbus.Interface(proxy, 'org.mpris.MediaPlayer2.Player')

APPNAME = "Player Navigation"
ICON = "/usr/share/icons/hicolor/48x48/apps/totem.png"

from gi.repository import AppIndicator3 as AI
from gi.repository import Gtk

# Forwards a song for 100 sec
def forward(item):
    player.Seek(100000000)

# Rewinds a song for 100 sec    
def rewind(item):
    player.Seek(-100000000)

def scroll(aai, ind, steps):
    print "hello" # doesn't print anything

def makemenu():
    ' Set up the menu '
    menu = Gtk.Menu()

    forward_item = Gtk.MenuItem('Forward')
    forward_item.connect('activate', forward)
    forward_item.show()

    rewind_item = Gtk.MenuItem('Rewind')
    rewind_item.connect('activate', rewind)
    rewind_item.show()

    exit_item = Gtk.MenuItem('Quit')
    exit_item.connect('activate', Gtk.main_quit)
    exit_item.show()

    menu.append(forward_item)
    menu.append(rewind_item)
    menu.append(exit_item)
    menu.show()
    return menu

def startapp():
    ai = AI.Indicator.new(APPNAME, ICON, AI.IndicatorCategory.HARDWARE)
    ai.set_status(AI.IndicatorStatus.ACTIVE)
    ai.set_menu(makemenu())
    ai.connect("scroll-event", scroll)
    Gtk.main()

startapp()

Hope this helps. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.