Sunday, July 13, 2008

Awn Icons

moonbeam has been working on a new feature in Awn called awn-icons, which allows users to drag an icon onto the applet itself and change the icon. The user can choose from the applet instance, the applet, or the type of icon for applying. So, if a user drags a new icon onto File Browser Launcher and chooses icon type, all of the applets that use the 'folder' icon will change. (AFAIK, this would require a restart of Awn/ the applets.)
This enables users to change icons for applets that they couldn't before, such as the media icons and MiMenu. Use Ubuntu but want the translucent GNOME logo on MiMenu? Just drag and drop it on MiMenu. Got some nice back, play, and forward icons? Just drag them on to the media icons applets.

Applets that have been converted (note: I'll try my best to keep this updated):
*AWNLib (not an applet, but still)
*Awn Notification Daemon
*Awn Terminal
*Cairo Menu
*Cairo Menu Classic
*File Browser Launcher
*Main Menu
*Media Control
*Media Icons
*Mount Applet
*Mobile Meebo
*Quit Applet
*Run (not in Awn Extras)
*Show Desktop
*Tomboy Applet
*Web Applet
IIRC, every applet that should use Awn Icons does. (!)

Several applets distribute icons that aren't found in a normal theme and use them as their icons. One example is the Quit Applet. You have to modify Makefiles to place the icons in the appropriate directory. I'll show the Quit Applet's [Make]files.



SUBDIRS = icons
APPLET_NAME = quit-applet
include $(top_srcdir)/Makefile.python-applet
dist_applet_DATA = \


[Desktop Entry]
Name=Quit-Logoff applet
Comment=A applet to exit your session
Name[en_US]=Quit-Logoff applet


dist_quitapplet_DATA = \
application-exit.svg \

quitappletdir = ${prefix}/share/avant-window-navigator/applets/quit-applet/icons/scalable/apps/

You must place the icon[s] in a separate directory named "icons," otherwise this won't work. Note that you can actually omit the instances of "scalable/apps," which would be better if you have only one icon. Also, if your icon is not an SVG image, either change "scalable" or just omit that part.

Now all the quit applet has to do to get the icon is this:
self.set_awn_icon('quit-applet', 'application-exit')

If an applet needs the icon as a Pixbuf, such as for preferences dialogs, etc., the set_awn_icon method returns the Pixbuf. It's owned by awn-icons, so you would want to use the awn-icons API directly, which currently doesn't have Python bindings.

Note: If you are using this as a tutorial for converting these applets and you need anything clarified, etc., just tell me. :)

No comments: