2

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.

0

2 Answers 2

5

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.

1
  • 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. Oct 8, 2012 at 9:00
2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .