File indexing completed on 2024-12-29 05:05:33

0001 
0002 function swapWidget(cont, oldWidget, newType, geometry) {
0003     oldWidget.remove();
0004     cont.addWidget(newType, geometry.x, geometry.y, geometry.width, geometry.height);
0005 }
0006 
0007 var containments = desktops().concat(panels());
0008 
0009 for (var i in containments) {
0010     var cont = containments[i];
0011 
0012     for (var j in cont.widgetIds) {
0013         var widget = cont.widgetById(cont.widgetIds[j]);
0014 
0015         let newType = ""
0016         if (widget.type == "org.kde.plasma.systemloadviewer") {
0017             let geometry = widget.geometry;
0018             geometry.width = geometry.width/3
0019             
0020             widget.remove();
0021             cont.addWidget("org.kde.plasma.systemmonitor.cpuusage", geometry.x, geometry.y, geometry.width, geometry.height);
0022             geometry.x += geometry.width;
0023             cont.addWidget("org.kde.plasma.systemmonitor.memoryusage", geometry.x, geometry.y, geometry.width, geometry.height);
0024             geometry.x += geometry.width;
0025 
0026             let swapWidget = cont.addWidget("org.kde.plasma.systemmonitor", geometry.x, geometry.y, geometry.width, geometry.height);
0027             swapWidget.currentConfigGroup = ["Appearance"];
0028             swapWidget.writeConfig("title", "Swap");
0029             swapWidget.currentConfigGroup = ["Sensors"];
0030             swapWidget.writeConfig("highPrioritySensorIds", "[\"mem/swap/used\",\"mem/swap/free\"]");
0031             swapWidget.writeConfig("totalSensors", "[\"mem/swap/used\"]");
0032             swapWidget.currentConfigGroup = ["SensorColors"];
0033             swapWidget.writeConfig("mem/swap/free", "230,230,230");
0034 
0035             swapWidget.reloadconfiguration(); 
0036         }
0037     }
0038 }
0039