-
 KDE-Apps.org Applications for the KDE-Desktop 
 GTK-Apps.org Applications using the GTK Toolkit 
 GnomeFiles.org Applications for GNOME 
 MeeGo-Central.org Applications for MeeGo 
 CLI-Apps.org Command Line Applications 
 Qt-Apps.org Free Qt Applications 
 Qt-Prop.org Proprietary Qt Applications 
 Maemo-Apps.org Applications for the Maemo Plattform 
 Java-Apps.org Free Java Applications 
 eyeOS-Apps.org Free eyeOS Applications 
 Wine-Apps.org Wine Applications 
 Server-Apps.org Server Applications 
 apps.ownCloud.com ownCloud Applications 
--
-
 KDE-Look.org Artwork for the KDE-Desktop 
 GNOME-Look.org Artwork for the GNOME-Desktop 
 Xfce-Look.org Artwork for the Xfce-Desktop 
 Box-Look.org Artwork for your Windowmanager 
 E17-Stuff.org Artwork for Enlightenment 
 Beryl-Themes.org Artwork for the Beryl Windowmanager 
 Compiz-Themes.org Artwork for the Compiz Windowmanager 
 EDE-Look.org Themes for your EDE Desktop 
--
-
 Debian-Art.org Stuff for Debian 
 Gentoo-Art.org Artwork for Gentoo Linux 
 SUSE-Art.org Artwork for openSUSE 
 Ubuntu-Art.org Artwork for Ubuntu 
 Kubuntu-Art.org Artwork for Kubuntu 
 LinuxMint-Art.org Artwork for Linux Mint 
 Arch-Stuff.org Art And Stuff for Arch Linux 
 Frugalware-Art.org Themes for Frugalware 
 Fedora-Art.org Artwork for Fedora Linux 
 Mandriva-Art.org Artwork for Mandriva Linux 
--
-
 KDE-Files.org Files for KDE Applications 
 OpenTemplate.org Documents for OpenOffice.org
 GIMPStuff.org Files for GIMP
 InkscapeStuff.org Files for Inkscape
 ScribusStuff.org Files for Scribus
 BlenderStuff.org Textures and Objects for Blender
 VLC-Addons.org Themes and Extensions for VLC
--
-
 KDE-Help.org Support for your KDE Desktop 
 GNOME-Help.org Support for your GNOME Desktop 
 Xfce-Help.org Support for your Xfce Desktop 
--
openDesktop.orgopenDesktop.org:   Applications   Artwork   Linux Distributions   Documents    LinuxDaily.com    Linux42.org    OpenSkillz.com   
 
Apps
News
Groups
Knowledge
Events
Forum
People
Jobs
Register
Login

-
- News . 
0
votes
click to vote up

extending plasma desktop scripting


Published Mar 12 2013 via RSS

The Plasma Desktop Scripting system allows one to add, remove or alter essentially any aspect of a running Plasma Desktop or Netbook shell at runtime using nothing more than javascript. This scripting system is used to define the initial setup you get when you log in for the first time, to provide configure updates and to provide user-friendly ways of adding new kinds of panels and desktop layouts. You can even write scripts interactively by typing "desktop console" into krunner.

Today I was asked on irc if one could extend the Javascript API at runtime so that instead of people writing scripts having to know how your applet works internally they could just call things like "awesomeWidget.setTheme('foo')" and have that do the correct thing.

At first I said "no" because the API is defined and managed by the shell and that's all C++ and there is no plugin mechanism .. but then about five seconds later I remembered that I had indeed added a plugin system. In fact, that is how the "New panel" menu works in Plasma Desktop. I even had an example on disk: org.kde.plasma-desktop.findWidgets. This is a small  desktop scripting template package with ~13 lines of Javascript that adds a findWidgets call to the API.

Here is how you use it in practice:

var finder = loadTemplate('org.kde.plasma-desktop.findWidgets');
finder.findWidgets("pager", function(widget, containment) {
    print("Found a pager with id " + widget.id + " in a " + containment.type + " containment with id " + containment.id);
})
Which gets me output like this on my laptop:
Found a pager with id 4 in a panel containment with id 1
The "big trick" is that the findWidgets package does not have an X-Plasma-ContainmentCategories entry in the metadata.desktop file which prevents it from showing up anywhere in the user interface. As a result, it is only accessible via the loadTemplate call when installed into share/apps/plasma/layout-templates/.

You can distribute layout template packages with your Plasmoids or other Plasma add-ons to allow easy (and future-proof) interaction with your add-ons from user written scripts.

 Such fun.



BackRead original postSend to a friend

Add comment

Add comment
Show all posts




-
 
 
 Who we are
Contact
More about us
Frequently Asked Questions
Register
Twitter
Blog
Explore
Apps
Jobs
Knowledge
Events
People
Updates on identi.ca
Updates on Twitter
Facebook App
Content RSS   
Events RSS   

Participate
Groups
Forum
Add App
Public API
About GTK-Apps.org
Legal Notice
Spreadshirt Shop
CafePress Shop
Advertising
Sponsor us
Report Abuse
 

Copyright 2007-2014 GTK-Apps.org Team  
All rights reserved. GTK-Apps.org is not liable for any content or goods on this site.
All contributors are responsible for the lawfulness of their uploads.