a cute little home a cute little boy a cute little cow: mooo!

Tale of a little pixel

a cute little girl

Script your netbook

This post is of the boring-with code type, but if you are a distribution packager read till the end, it's important :)

As said by Aaron some days ago, now Plasma can be controlled vith Javascript code.

This is useful for creating the default setup, for quicly controlling the desktop look and feel, to handle updates in the configuration files and even for controlling large deployments.

Setup scripts can also be packaged in the same format as the Javascript based plasmoids, so in the future (probably 4.6 timeframe?) will be possible to distribute and downoad setup for actvities, for instance with get hot new stuff.

Now not only the Plasma Desktop is using it: also the netbook has full scripting support, this will make really easy for distributions to customize the default layout as needed.

so, let's see how it's done:


It loads 3 packages, one for the Search and launch activity, one for the panel and one for the newspaper. The newspaper is:

var page = new Activity("newspaper")
//not shown by default
page.screen = -1
//properties for the wallpaper
page.wallpaperPlugin = 'image'
page.wallpaperMode = 'SingleImage'
//templateName comes from the desktop file of the package,
//and will be translated = templateName

page.addWidgetAt("news", 0, 0)
page.addWidgetAt("weather", 1, 0)
page.addWidgetAt("opendesktop", 0, 1)
page.addWidgetAt("knowledgebase", 1, 1)

It adds the default widgets, will be possible to distribute and download different pages. The search and launch instead is the following:

var sal = new Activity("sal")
sal.screen = 0
sal.wallpaperPlugin = 'image'
sal.wallpaperMode = 'SingleImage' = templateName
sal.writeConfig("PackageManager", "kpackagekit")

The PackageManager bit here is particularly important: a new feature of the Search and Launch activity for 4.5 is a new button in the toolbox, called "Add applications" (complementar to the usual "add widgets") it will launch the gui for the package manager... now, since it's highly distribution dependent it will have to be customized. Here uses as default "kpackagekit" this is the name of the desktop file of the application, in OpenSuse that line would become for instance sal.writeConfig("PackageManager", "package-manager") and so on

It's a small little bit, but it's an important piece to give it a more integrated and easy experience.

Submit comment