Adding icons on the taskbar by javascript scripting

Aaron J. Seigo aseigo at kde.org
Fri Jan 22 21:37:57 CET 2010


On January 22, 2010, Nicolas Lécureuil wrote:
> var panel = new Panel()
> panel.addWidget("icon")
> 
> this add an empty icon
> 
> Is there a way to add a link ?

probably something like:

var icon = panel.addWidget("icon")
icon.writeConfig("Url", "path_to_whatever_the_icon_should_represent")

does that do what you want/need?

note that i just backported a fix for the icon widget that you will need to 
get for this to have any change of working without restarting plasma. 
(implemented configChanged()) 

> Before adding icons i would like to check if the desktop file exist, but it
> doesn't seems possible to use Url() on those scripts.

i could easily add add Url to the script env, but that won't help you with 
figuring out if the file exists or not. what would probably make more sense 
would be to have a fileExists() function in the runtime. if you'd find Url 
useful for some other purpose, let me know. but i'll add the fileExists() 
method and backport.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks


More information about the Plasma-devel mailing list