Wednesday, June 05, 2013

New Plasma scripting features in 4.11

Since Martin blogged about the new scripting related features in kwin coming to 4.11 today, I figured that I would do the same for plasma-desktop.

Plasma Desktop Scripting

After having been asked for the ability to read and write from other user config files in Plasma Desktop Scripting for the Nth time, I finally buckled down and implemented it. It is documented on the desktop scripting wiki page and using it looks something like this:

// open the kickoffrc file
var config = ConfigFile('kickoffrc');

// switch to the RecentlyUsed group
config.group = 'RecentlyUsed';

// write an entry into it
config.writeEntry('MaxApplications', 25);


// now put Yes=20 into RecentlyUsed/Test
var config2 = ConfigFile(config, 'Test);
config2.writeEntry('Yes', 20);
This is actually re-using the KConfig bindings written by Sebastian Kügler for QML that we ship in the Plasma Active Settings QML import, so it turned out to be very little work to add it, test it and push it for 4.11.

QML

QML is the way write visual Plasma addons such as plasmoids these days, and so it is the support that gets the most attention and love. In addition to numerous bug fixes to the various components and imports, the following new features are available in 4.11:
  • A plasmoid (or other) package can provide fallbacks for SVGs that are themed. This allows a plasmoid to safely use an SVG that may only be in some themes while providing its own fallback. Taking this even further, you can even provide SVGs for specific themes by dropping them in a folder that shares the theme's name.
  • A units object was introduced that provides compatibility with Ubuntu Touch's object of the same name. They work identically, and the idea is to make writing apps that target multiple platforms a bit easier. Scanning through various QML applications written with Ubuntu Touch in mind, this was by far and away the most often used bit of their API. Personally, I disagree with using such literal units and prefer to have fluid layouts, but compatibility is a boon for all QML platforms.
Most of the work done for 4.11 in the QML support was bug fixes and polishing. This is to be expected as the support is now quite mature and further feature work for QML support has shifted to Qt5's QML2 for Plasma Workspaces 2.

2 comments:

nowardev said...

:) good

Kiran Kumar P said...

It's nice to see KDE trying to be compatible with other DEs.