// configure plasma defaults function forEachWidgetInContainmentList(containmentList, callback) { for (var containmentIndex = 0; containmentIndex < containmentList.length; containmentIndex++) { var containment = containmentList[containmentIndex]; var widgets = containment.widgets(); for (var widgetIndex = 0; widgetIndex < widgets.length; widgetIndex++) { var widget = widgets[widgetIndex]; callback(widget, containment); if (widget.type === "org.kde.plasma.systemtray") { systemtrayId = widget.readConfig("SystrayContainmentId"); if (systemtrayId) { forEachWidgetInContainmentList([desktopById(systemtrayId)], callback) } } } } } function forEachWidget(callback) { forEachWidgetInContainmentList(desktops(), callback); forEachWidgetInContainmentList(panels(), callback); } function forEachWidgetByType(type, callback) { forEachWidget(function(widget, containment) { if (widget.type == type) { callback(widget, containment); } }); } function widgetSetProperty(args) { if (!(args.widgetType && args.configGroup && args.configKey)) { return; } forEachWidgetByType(args.widgetType, function(widget){ widget.currentConfigGroup = [args.configGroup]; /* //--- Delete when done debugging const oldValue = widget.readConfig(args.configKey); print("" + widget.type + " (id: " + widget.id + "):"); print("\t[" + args.configGroup + "] " + args.configKey + ": " + oldValue + " => " + args.configValue + "\n"); //--- End Debug */ widget.writeConfig(args.configKey, args.configValue); }); } // configure task bar starters: widgetSetProperty({ widgetType: "org.kde.plasma.icontasks", configGroup: "General", configKey: "launchers", configValue: [ "applications:systemsettings.desktop", "preferred://browser", "applications:thunderbird.desktop", "applications:libreoffice-startcenter.desktop", "preferred://filemanager" //"applications:org.kde.konsole.desktop", //"applications:org.kde.discover.desktop" ], }); // kickoff is the default menu: /* this does not work (anymore?) widgetSetProperty({ widgetType: "org.kde.plasma.kickoff", configGroup: "General", configKey: "favorites", configValue: ["applications:libreoffice-startcenter.desktop",], }); */ widgetSetProperty({ widgetType: "org.kde.plasma.kickoff", configGroup: "General", configKey: "systemFavorites", configValue: ["reboot", "shutdown", "logout"], }); // prepare a folder view on the desktop: /* 20230917 disabled for now var allDesktops = desktops(); for (var desktopIndex = 0; desktopIndex < allDesktops.length; desktopIndex++) { var d = allDesktops[desktopIndex]; d.addWidget("org.kde.plasma.folder", 50, 50, 456, 600) print("Folder app generated!\n") } widgetSetProperty({ widgetType: "org.kde.plasma.folder", configGroup: "General", configKey: "url", configValue: "/lmn/media/", }); widgetSetProperty({ widgetType: "org.kde.plasma.folder", configGroup: "General", configKey: "labelMode", configValue: "0", }); */ // /usr/share/plasma/shells/org.kde.plasma.desktop/contents/updates/fvs-config.js