Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Some applications place informational text over their icons in the Launcher.

For example, Thunderbird shows the unread message count, and Update Manager shows the number of updates available and a progress bar. The image shows these two examples:

Launcher icons with information overlay

I have created some Bash scripts that use yad (a Zenity fork), which adds an icon to the Launcher while running.

I would like to know how I can create my own information overlay within my script for those icons.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

This is for Python, perhaps something can be found for another language..

From the update-manager source, UnitySupport.py:

You need to:

from gi.repository import Dbusmenu, Unity

to get Unity support.

You can then define a function:

def set_launcher_icon_num(self, num_count):
    self._unity.set_property("count", num_count)
    if num_count > 0:
        self._unity.set_property("count-visible", True)
    else:
        self._unity.set_property("count-visible", False)

Also, to show urgency(shake the icon),

self._unity.set_property("urgent", urgent)

or to create a progressbar,

self._unity.set_property("progress", progress/100.0)

where progress is from 0 to 100. You can then use:

self._unity.set_property("progress_visible", True)

to show the progressbar and use False instead of True to hide it.

As always, searching the source of a program that does what you are trying to do can be worthwhile.

These are subject to change at anytime. You can also see the Unity API.

share|improve this answer
    
Thank you. This answer has useful links and information. Unfortunately, I do not know Python nor do I have the time to learn it. I'll see if I can get my son to write a Python or C script to use from Bash! I'll mark this as an answer, although I am not able to test it as yet. –  Paddy Landau Oct 8 '12 at 9:00

I don't think you can do it through bash directly, you have to interface with the API. There are python bindings through gi introspection. See this page which has python and vala examples: https://wiki.ubuntu.com/Unity/LauncherAPI

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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