I have just developed a (yet very simple) pavucontrol applet. That applet consists of two files. These are a bonobo server file GNOME_Pavucontrol.server and the actual applet gnome-pavucontrol-applet.py. You will find the corresponding source code below. My applet has successfully been tested on Ubuntu Linux 9.10.
To install the applet:
1. Copy GNOME_Pavucontrol.server to /usr/lib/bonobo/servers.
2. Change the "location" of the actual applet in the above file to whatever location suits you.
3. Copy gnome-pavucontrol-applet.py to exactly that location.
4. Right-click on your GNOME panel and select "Add to panel".
5. Choose "pavucontrol applet" from the list.
6. An applet titled "Sound Preferences" should now become visible on your GNOME panel.
Todo:
Make the applet look more appealing.
Source code of GNOME_Pavucontrol.server:
Source code of gnome-pavucontrol-applet.py:
#!/usr/bin/env python
import pygtk
import sys
pygtk.require('2.0')
import gtk
import gnomeapplet
import subprocess
import os, signal
import time
p='NULL'
def sample_factory(applet, iid):
button = gtk.Button()
button.set_relief(gtk.RELIEF_NONE)
button.set_label("Sound Preferences")
button.connect("button_press_event", showPreferences, applet)
applet.add(button)
applet.show_all()
return gtk.TRUE
def showPreferences(widget, event, applet):
global p
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
widget.emit_stop_by_name("button_press_event")
p=subprocess.Popen('pavucontrol')
def destroy(self):
global p
if sys.version_info > (2, 6):
p.terminate()
gtk.main_quit()
if len(sys.argv) == 2 and sys.argv[1] == "run-in-window":
main_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
main_window.set_title("Pavucontrol Applet")
main_window.connect("destroy", destroy)
app = gnomeapplet.Applet()
sample_factory(app, None)
app.reparent(main_window)
main_window.show_all()
gtk.main()
sys.exit()
if __name__ == '__main__':
print "Starting factory"
gnomeapplet.bonobo_factory("OAFIID:GNOME_PavucontrolApplet_Factory", gnomeapplet.Applet.__gtype__, "pavucontrol", "0", sample_factory)