Custom indicator applet icon

Recently, I have been helping out many, many people in #ubuntu-app-devel on Freenode with getting a their application indicator to use a custom icon. I recently went through a lot of hassle trying to figure this out, so I thought I would post about it.

So normally to initialize your application indicator, you would have something like this:

ind = appindicator.Indicator("MyApp", "my-app-icon", appindicator.CATEGORY_APPLICATION_STATUS)

But that will only allow you to use icons in the current icon theme, not your own, so to fix this you just need to specify the path like so:

ind = appindicator.Indicator("MyApp", "/usr/share/myapp/media/my-app-icon.png", appindicator.CATEGORY_APPLICATION_STATUS)

The above code assumes that your app is a Quickly application (/usr/share/myapp/ is where Quickly applications install themselves to). If your application is not a Quickly application then you just need to point the path where your icon is when the application is installed.

Enjoy!

Advertisements

6 Comments on “Custom indicator applet icon”

  1. dave says:

    I find it is better if the person registers their icon with the icon themes, it can be done like this howerever it is done when the program is installing

    sudo xdg-icon-resource install –theme hicolor –novendor –size 16 hicolor/my-app-icon.png my-app-icon

    and

    sudo xdg-icon-resource install –theme ubuntu-mono-dark –novendor –size 16 dark/my-app-icon.pngg my-app-icon

    the theme “hicolor” is the default icon theme used if the current selected theme does not contain an icon chosen

    so this would now work and let you have custom icons for different themes with a guaranteed default icon to be used
    ind = appindicator.Indicator(“MyApp”, “my-app-icon”, appindicator.CATEGORY_APPLICATION_STATUS)

    I used this way in my program rss-aware

  2. Owais Lone says:

    Wow.. this is nice.

  3. […] This post was mentioned on Twitter by László Torma, Arjan Waardenburg. Arjan Waardenburg said: Ryan Macnish: Custom indicator applet icon: Recently, I have been helping out many, many people in #ubuntu-app-d… http://bit.ly/hmcQ3s […]

  4. Specifying the full path to an icon is something to avoid. You should use named icons, in order to allow themability (not only for pleasure, but also for accessibility reasons).

    The proper way to use app specific icons in GNOME desktop is described here: http://live.gnome.org/ThemableAppSpecificIcons

    I’m sure you can do the same in Python

    • nisshh says:

      Oh, using a custom icon for the application itself is not an issue, its trying to do the same in an Indicator Applet that’s the issue, indicator-applications currently lacks the ability to do this easily, but once it can do it without app devs having to specify a full path, it would be preferrable to do it the proper way.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s