Ubuntu – How to let an icon in the launcher wiggle

application-developmentcpythonunity

Trying to let my python application inform the user by wiggling or shaking its icon
in the launcher, I found:

Wiggling seems to be the "urgent animation":
How can I change the wiggle time of 'urgent animation' in Unity Launcher?

https://wiki.ubuntu.com/Unity/LauncherAPI
describes an API with a function to set an urgent flag on a LaucherEntry.
But the vala example doesn't use it and the python example doesn't show any visual effect on my Ubuntu 11.10 for setting (or clearing) the "urgent" property (progress and count are working). The example python code does not use the API-C function unity_launcher_entry_set_urgent, but writes to the property directly, which maybe is the problem (and means not using the API in an API documentation example …)

So, I am looking for a working python "wiggle" example. Or a working C example.
Or some hints, why this is not working.

Best Answer

Check out the Python example in the Unity developer documentation, and try hello-unity (only compatible with Ubuntu 12.04). These are good places to start.

Here's some bit of Python code that will make your app's icon wiggle in the launcher. It's for Ubuntu 12.04, but looking at the API documentation, it should also work for 11.10.

from gi.repository import Unity

self.launcher = Unity.LauncherEntry.get_for_desktop_id("myapp.desktop")
self.launcher.set_property("urgent", True)