This forum has been archived. All content is frozen. Please use KDE Discuss instead.

plasma-desktop init scripting [SOLVED]

Tags: None
(comma "," separated)
jamie_boo
Registered Member
Posts
4
Karma
0
OS
I am using kubuntu 10.10 with.
EDIT: KDE 4.5.3
As part of pre-configuring the desktop for Linux Mint 10 KDE I have hit some issues with plasma-desktop initialisation scripting.
ie .../share/apps/plasma-desktop/init/00-defaultLayout.js
Now i can setup the desktop, panel, and widgets. the basic layout, this looks good. but when i also apply some configs eg icons. the get put in the ~/.kde/share/config/plasma-destop-appetsrc but not applied on first login. You have to login again for the configs to be applied. ie widgets have the correct icons.
The other config i just can not apply or even set in plasma-desktop-appletsrc at all is the wallpaper.
[containments][1][Wallpaper][image]
...
wallpaper=/usr/share/wallpapers/linuxmint
...
I don't know if I am missing something from the script (some sort of reload, I have tried a few) or is what i want to do just not possible yet?

Here is my 00-defaultLayout.js so far. You will see a lot of commented out lines as i have been trying things. I have found multiple ways to do things too but this is what i am at now.
This gives me the layout of desktop and widgets, just not the wallpaper (at all) or the icons applied to the widgets until 2nd login.

var activity = new Activity("desktop");

activity.writeConfig("wallpaperplugin", "image");
activity.writeConfig("wallpaperpluginmode", "SingleImage");
//activity.reloadConfig();
activity.currentConfigGroup = new Array("Wallpaper", "image");
//activity.userswallpapers = "";
activity.wallpaper = "/usr/share/wallpapers/linuxmint";
//activity.wallpapercolor = "1,1,1";
//activity.wallpaperposition = "0";
//reloadConfig(activity);
//activity.currentConfigGroup = Array();
//reloadConfig(activity);

folderview = activity.addWidget("folderview");
folderview.writeConfig("url", "desktop:/");

var screenrect = screenGeometry(0);

var panel = new Panel("panel");
panel.location = "bottom";
launcher = panel.addWidget("lancelot_launcher");
launcher.globalShortcut = "Alt+F1"
panel.addWidget("quickaccess");
panel.addWidget("showdesktop");
panel.addWidget("tasks");

systray = panel.addWidget("systemtray");
i = 0;
if (hasBattery) {
systray.currentConfigGroup = new Array("Applets", ++i);
systray.writeConfig("plugin", "battery");
}
systray.currentConfigGroup = new Array("Applets", ++i);
systray.writeConfig("plugin", "message-indicator");
systray.currentConfigGroup = new Array("Applets", ++i);
systray.writeConfig("plugin", "org.kde.networkmanagement");
systray.currentConfigGroup = new Array("Applets", ++i);
systray.writeConfig("plugin", "notifier");

clock = panel.addWidget("digital-clock");
clock.writeConfig("showDate", "true");

// desktop.
//var activity = activityForScreen(0)
//activity.currentConfigGroup = new Array("Wallpaper", "image");
//activity.userswallpapers = "";
//activity.wallpaper = "/usr/share/wallpapers/linuxmint/emvalibe_silver.jpg";
//activity.wallpapercolor = "1,1,1";
//activity.wallpaperposition = "0";

// icons.
for (var i = 0; i < panelIds.length; ++i) {
var panel = panelById(panelIds[i]);
var widgetIds = panel.widgetIds;

for (var j = 0; j < widgetIds.length; ++j) {
var widget = panel.widgetById(widgetIds[j]);
if (widget && (widget.type == 'quickaccess') &&
(widget.readConfig("icon", "") != "user-home")) {
widget.writeConfig("icon", "user-home");
//reloadConfig(widget);
} // if quickaccess
if (widget && (widget.type == 'launcher') &&
(widget.readConfig("icon", "") != "/usr/share/linuxmint/mint-kde-icon-light-bg.png")) {
widget.writeConfig("icon", "/usr/share/linuxmint/mint-kde-icon-light-bg.png");
//reloadConfig(widget);
} // if launcher
if (widget && (widget.type == 'lancelot_launcher') &&
(widget.readConfig("icon", "") != "/usr/share/linuxmint/mint-kde-icon-light-bg.png")) {
widget.writeConfig("icon", "/usr/share/linuxmint/mint-kde-icon-light-bg.png");
//reloadConfig(widget);
} // if lancelot_launcher
} // for widgets in panel
//reloadConfig(panel);
} // for panel


Cheers
Jamie

Last edited by jamie_boo on Sat Jan 08, 2011 3:23 am, edited 2 times in total.
jamie_boo
Registered Member
Posts
4
Karma
0
OS

Re: plasma-desktop init scripting

Sun Dec 19, 2010 6:35 am
Update: I have updated some KDE updates, but the versions are a bit varied.
kdepim* is at 4.4.8
KDE is at 4.5.4
I am still having the same script problems.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: plasma-desktop init scripting

Tue Dec 21, 2010 3:32 am
I suggest contacting the Plasma Developers on plasma-devel@kde.org for assistance with this.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
jamie_boo
Registered Member
Posts
4
Karma
0
OS

Re: plasma-desktop init scripting

Fri Dec 24, 2010 10:37 am
The results are in, thanks to Aaron Seigo (KDE plasma dev).
KDE 4.6 should have the init script working for KDE palsma. But the third party plasma apps may not implement configChange() properly yet.
So I have updated the init script that will hopefully work with 4.6 as desired and 4.5 with some icon and wallpaper hacks.

here is the updated script.

var activity = new Activity("desktop")
activity.wallpaperPlugin = "image"
activity.wallpaperMode = "SingleImage"
activity.currentConfigGroup = Array("Wallpaper", "image")
activity.writeConfig("wallpaper", "Mint_Julia")

folderview = activity.addWidget("folderview")
folderview.writeConfig("url", "desktop:/")

var screenrect = screenGeometry(0)

var panel = new Panel("panel")
panel.location = "bottom"
launcher = panel.addWidget("lancelot_launcher")
launcher.globalShortcut = "Alt+F1"
panel.addWidget("quickaccess")
panel.addWidget("showdesktop")
panel.addWidget("tasks")

systray = panel.addWidget("systemtray")
i = 0;
if (hasBattery) {
systray.currentConfigGroup = new Array("Applets", ++i)
systray.writeConfig("plugin", "battery")
}
systray.currentConfigGroup = new Array("Applets", ++i)
systray.writeConfig("plugin", "message-indicator")
systray.currentConfigGroup = new Array("Applets", ++i)
systray.writeConfig("plugin", "org.kde.networkmanagement")
systray.currentConfigGroup = new Array("Applets", ++i)
systray.writeConfig("plugin", "notifier")

clock = panel.addWidget("digital-clock")
clock.writeConfig("showDate", "true")

// icons change.
for (var i = 0; i < panelIds.length; ++i) {
var panel = panelById(panelIds[i])
var widgetIds = panel.widgetIds

for (var j = 0; j < widgetIds.length; ++j) {
var widget = panel.widgetById(widgetIds[j]);

if (widget && (widget.type == 'quickaccess') &&
(widget.readConfig("icon", "") != "user-home")) {
widget.writeConfig("icon", "user-home")
} // if quickaccess

if (widget && (widget.type == 'launcher') &&
(widget.readConfig("icon", "") != "/usr/share/linuxmint/mint-kde-icon-light-bg.png")) {
widget.writeConfig("icon", "/usr/share/linuxmint/mint-kde-icon-light-bg.png")
} // if launcher

if (widget && (widget.type == 'lancelot_launcher') &&
(widget.readConfig("icon", "") != "/usr/share/linuxmint/mint-kde-icon-light-bg.png")) {
widget.writeConfig("icon", "/usr/share/linuxmint/mint-kde-icon-light-bg.png")
} // if lancelot_launcher
} // for widgets in panel
} // for panel


I hope this helps others too.

Cheers
Jamie


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]