#!/bin/sh
# setup_plasma-desktop.sh

JS=$(mktemp)
cat > $JS <<EOF
// This script will set up your desktop.
// Please click "Execute" to run it.
//
// It will edit the following file:
// .kde/share/config/plasma-desktop-appletsrc
//
// The following command can be used to open this console:
// qdbus org.kde.plasma-desktop /MainApplication showInteractiveConsole
// qdbus org.kde.plasma-desktop /MainApplication loadScriptInInteractiveConsole /path/to/file
//
// The default init scripts are located at:
// /usr/share/apps/plasma-desktop/init/
//
// More information can be found at:
// http://techbase.kde.org/KDE_System_Administration/PlasmaDesktopScripting
// http://blog.zx2c4.com/699
// http://apachelog.wordpress.com/2010/02/24/opportunistic-plasma-scripting-for-feature-rich-kubuntu-deployments-and-the-like/

var activity = activities()[0];
activity.wallpaperMode = "Slideshow";
activity.currentConfigGroup = new Array("Wallpaper", "image");
activity.writeConfig("slideTimer", 3600);

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

var sysmon = activity.addWidget("system-monitor_applet");
sysmon.writeConfig("applets", "sm_cpu,sm_ram,sm_net");

var weather = activity.addWidget("weather");

activity.reloadConfig();
EOF

qdbus org.kde.plasma-desktop /MainApplication loadScriptInInteractiveConsole "$JS"
rm "$JS"
#rm "$0"