Friday, May 3, 2024
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 512  / 2 Years ago, wed, september 14, 2022, 6:00:26

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.


More From » command-line

 Answers
4

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.


[#35099] Thursday, September 15, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ligdesig

Total Points: 164
Total Questions: 106
Total Answers: 114

Location: Japan
Member since Sat, Jun 6, 2020
4 Years ago
;