Javascript Interaction With Plasma Shells
Desktop scripting lets you control and interact with a Plasma user interface
Get access to Plasma functionality and its widgets.
Examples
Advanced example: Adding a widget to the System Tray
const widgetName = "org.kde.plasma.printmanager";
panelIds.forEach((panel) => { //search through the panels
panel = panelById(panel);
if (!panel) {
return;
}
panel.widgetIds.forEach((appletWidget) => {
appletWidget = panel.widgetById(appletWidget);
if (appletWidget.type === "org.kde.plasma.systemtray") {
systemtrayId = appletWidget.readConfig("SystrayContainmentId");
if (systemtrayId) {
print("systemtray id: " + systemtrayId)
const systray = desktopById(systemtrayId);
systray.currentConfigGroup = ["General"];
const extraItems = systray.readConfig("extraItems").split(",");
if (extraItems.indexOf(widgetName) === -1) {
extraItems.push(widgetName)
systray.writeConfig("extraItems", extraItems);
systray.reloadConfig();
}
}
}
});
});Running Scripts
Global theme dependent default setup for applets
Last updated