How to add touchpad and battery for notebooks
Ludwig Cornelius
t_d_l_c at gmx.de
Mon Apr 9 12:49:14 UTC 2018
Hi,
thank you very much, it works!!
Best wishes from munich,
Ludwig
Am 06.04.2018 um 16:51 schrieb Marco Martin:
> On Thu, Apr 5, 2018 at 11:38 AM, Ludwig Cornelius <t_d_l_c at gmx.de> wrote:
>> Hi dear mailing list,
>>
>>
>> I want to add the widgets for touchpad and battery on notebooks
>> automatically by using a script or configuration file. Is this possible?
> Hi,
> isn't the battery automatically there for laptops?
>
> anyways, the systray changed a bit in plasma5, to find it you can do
> as following,
> I have adapted from a portion of your script to add the "print
> manager" widget in the systray, you probably want to replace that with
> widgetName.
> A simplified version is also on the docs now:
> https://userbase.kde.org/KDE_System_Administration/PlasmaDesktopScripting#Advanced_example:_Adding_a_widget_to_the_System_Tray
>
> pids = panelIds;
> for (i = 0; i < pids.length; ++i) { //search through the panels
> panel = panelById(pids[i]);
> if (!panel) continue;
>
> for (tmpIndex = 0; tmpIndex < panel.widgetIds.length; tmpIndex ++) {
> appletWidget = panel.widgetById(panel.widgetIds[tmpIndex]);
> // l(0, appletWidget.type);
> if (appletWidget.type == widgetName) {
> l(1, widgetName + " already in panel");
> return;
> }
> else if (appletWidget.type == "org.kde.plasma.systemtray") {
> systemtrayId = appletWidget.readConfig("SystrayContainmentId");
> if (systemtrayId) {
> print("systemtray id: " + systemtrayId)
> var systray = desktopById(systemtrayId);
> systray.currentConfigGroup = ["General"];
> var extraItems = systray.readConfig("extraItems").split(",");
> if (extraItems.indexOf("org.kde.plasma.printmanager") === -1) {
> extraItems.push("org.kde.plasma.printmanager")
> systray.writeConfig("extraItems", extraItems);
> systray.reloadConfig();
> }
> print(extraItems);
> }
> }
> }
> }
>
>
> --
> Marco Martin
More information about the Enterprise
mailing list