You are not logged in.

#1 2025-11-12 20:51:21

jghodd
Member
Registered: 2013-02-10
Posts: 179

desktop addWidget javascript blocks panel instantiation in theme

I have a layout-template and a look-and-feel that work together to install a top panel, 2 widgets on the desktop and the related wallpaper. When plasma was updated to 6.5, this theme stopped working. Essentially, I can get either the top panel, or the widgets, but not both. If the code for creating the panel and the code for installing the widgets are both present, only the widgets are installed, and the panel is nowhere to be seen. If I remove the code to install the widgets, the panel shows up. I don't know if this is a bug or a change in the API, but over the past month I've tried rearranging the javascript code every way I could think of, and still the same pattern held - either the widgets or the panel but not both. There is a single exception: if I run the theme with both the panel and the widgets code, only the widgets show up, but... if I run plasma-interactiveconsole and execute only "var panel = new Panel;", the panel shows up. Weird. But it does tell me that the code is correctly creating all components.

Is there something I'm missing here?

Panel:

var screenWidthGridUnits = screenGeometry(0).width / gridUnit;
var screenHeightGridUnits = screenGeometry(0).height / gridUnit;

var screenWidth = screenGeometry(0).width;
var screenHeight = screenGeometry(0).height;

var panel = new Panel;

panel.location = "top";
panel.height = 1.6 * gridUnit;
panel.lengthMode = "custom";
panel.length = screenWidthGridUnits * 11;
panel.alignment = "center";
panel.hiding = "dodgewindows";
panel.minimumLength = panel.length;
panel.maximumLength = panel.length;

panelSpacer = panel.addWidget("org.kde.plasma.panelspacer");
panelSpacer.writeConfig("expanding", "false");
panelSpacer.writeConfig("length", 8);

kicker = panel.addWidget("org.kde.plasma.kicker");
kicker.writeConfig("customButtonImage", "start-here-kde");
kicker.writeConfig("useCustomButtonImage", "true");

panelSpacer = panel.addWidget("org.kde.plasma.panelspacer");
panelSpacer.writeConfig("expanding", "false");
panelSpacer.writeConfig("length", 8);

clock = panel.addWidget("org.kde.plasma.digitalclock");
clock.writeConfig("showDate", "false");

panelSpacer = panel.addWidget("org.kde.plasma.panelspacer");
panelSpacer.writeConfig("expanding", "false");
panelSpacer.writeConfig("length", 6);

lock_logout = panel.addWidget("org.kde.plasma.lock_logout");
lock_logout.writeConfig("show_requestLogout", "true");
lock_logout.writeConfig("show_requestLogoutScreen", "false");
lock_logout.writeConfig("show_requestReboot", "true");
lock_logout.writeConfig("show_requestShutDown", "true");

panelSpacer = panel.addWidget("org.kde.plasma.panelspacer");
panelSpacer.writeConfig("expanding", "false");
panelSpacer.writeConfig("length", 6);

calculate = panel.addWidget("org.kde.plasma.calculator");

panelSpacer = panel.addWidget("org.kde.plasma.panelspacer");
panelSpacer.writeConfig("expanding", "false");
panelSpacer.writeConfig("length", 17);

sysloadViewer = panel.addWidget("org.kde.plasma.systemmonitor.cpucore");

panelSpacer = panel.addWidget("org.kde.plasma.panelspacer");
sysTray = panel.addWidget("org.kde.plasma.systemtray");

Look-and-feel:

loadTemplate("org.bluestarlinux.desktop.bslxPanel")

var screenWidth = screenGeometry(0).width;
var screenHeight = screenGeometry(0).height;

var config = ConfigFile('kdeglobals');
config.group = 'KDE';

var lookandfeel    = config.readEntry('LookAndFeelPackage');
var wallpaperFile  = "contents/components/artwork/background.png"; 
var lookandfeelDir = userDataPath("data","plasma/look-and-feel"); 
var wallpaperImg   = lookandfeelDir + "/" + lookandfeel + "/" + wallpaperFile; 

var imagePath = "file://" + "/usr/share/plasma/look-and-feel/" + lookandfeel + "/" + wallpaperFile;

if (applicationExists(wallpaperImg)) 
    imagePath = "file://" + wallpaperImg;

var desktopsArray = desktops();
for (var j = 0; j < desktopsArray.length; j++) {
    var myDesktop = desktopsArray[j];

    var viewFolder = myDesktop.addWidget("org.kde.plasma.folder", 50, 75, screenWidth * 0.4, screenHeight * 0.75); 
    viewFolder.writeConfig("title", "Home"); 
    viewFolder.writeConfig("url", "file://" + userDataPath("")); 
    viewFolder.writeConfig("iconSize", "2"); 

    var installIcon = myDesktop.addWidget("org.kde.plasma.icon", screenWidth * 0.8, 80, screenWidth * 0.1, 75); 
    installIcon.writeConfig("title", "Bluestar Installer"); 
    installIcon.writeConfig("url", "file:///usr/share/applications/calamares.desktop"); 
    installIcon.writeConfig("localPath", userDataPath("") + "/.local/share/plasma_icons/calamares.desktop"); 

    myDesktop.wallpaperPlugin = "org.kde.image";
    myDesktop.currentConfigGroup = ["Wallpaper", desktopsArray[j].wallpaperPlugin, "General"];
    myDesktop.writeConfig("Image", imagePath);
    myDesktop.writeConfig("height", screenGeometry(0).height);
    myDesktop.writeConfig("width", screenGeometry(0).width);
}

var lockConfig = ConfigFile('kscreenlockerrc');
var lockConfig2 = ConfigFile(lockConfig, 'Greeter');
var lockConfig3 = ConfigFile(lockConfig2, 'Wallpaper');
var lockConfig4 = ConfigFile(lockConfig3, 'org.kde.image');
var lockConfig5 = ConfigFile(lockConfig4, 'General');
lockConfig5.writeEntry('Image', imagePath);
lockConfig5.writeEntry('SlidePaths', '/usr/share/wallpapers');

All software components are up to date, btw. And the panel's metadata file correctly identifies it as a panel.

Offline

#2 2025-11-13 16:14:58

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 70,997

Re: desktop addWidget javascript blocks panel instantiation in theme

What if you move

loadTemplate("org.bluestarlinux.desktop.bslxPanel")

below the desktop widgets?
Fwwi, https://distrowatch.com/table.php?distribution=bluestar is not https://distrowatch.com/table.php?distribution=arch

Offline

#3 2025-11-13 16:30:02

jghodd
Member
Registered: 2013-02-10
Posts: 179

Re: desktop addWidget javascript blocks panel instantiation in theme

@Seth - thank you. However, that didn't do it. I've tried moving the 2 sections around to run in all orders and it appears that the order in which it all runs is thus far irrelevant (it may ultimately prove to be relevant, but not so far). My gut feeling is that I'm missing a call to something or maybe the panel needs to be added to every desktop... I don;t know. I've tried that too. There's something missing here though that's new to how panels and desktops can be displayed on the same screen.

Fwiw, bluestar is my distro, so what I'm running on my system is stock arch linux with some self-built AUR packages installed.

Last edited by jghodd (2025-11-13 16:31:20)

Offline

#4 2025-11-13 17:09:36

jghodd
Member
Registered: 2013-02-10
Posts: 179

Re: desktop addWidget javascript blocks panel instantiation in theme

@Seth - the other interesting thing is that if you remove, specifically, the code that adds the desktop widgets, but leave in the code that adds the wallpaper to the desktops, the panel shows up. So it appears to be the 2 addWidget calls that cause the problem, although "appears" may actually be a different, as yet unknown, reason. Maybe it's what the widgets are being added to or that the panel needs to be added to something, or somehow the two aren;t being drawn onto the same screen, or desktop, or "canvas"... I don't know what the issue may be.

Offline

#5 2025-11-13 20:42:58

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 70,997

Re: desktop addWidget javascript blocks panel instantiation in theme

So it appears to be the 2 addWidget calls that cause the problem

Have you tried only one of them (or the other)?

Offline

#6 2025-11-13 22:29:35

jghodd
Member
Registered: 2013-02-10
Posts: 179

Re: desktop addWidget javascript blocks panel instantiation in theme

@Seth - yes. The one widget appears. No panel. I can only get the panel if I add no widgets to the desktop.

Offline

#7 2025-11-13 22:36:30

jghodd
Member
Registered: 2013-02-10
Posts: 179

Re: desktop addWidget javascript blocks panel instantiation in theme

I've tried just about everything. I even converted the whole thing to an auto-initialized layout structure, and still no go. Same thing. I can only conclude that the order of execution doesn;t much matter. I believe I'm missing something more fundamental, like which screen/drawable/desktop/canvas the panel is being created on vs the desktop - are they different? What on earth did they change in plasma 6.5 that changed something so fundamental? This theme (and many others) have been developed over 10+ years and have been working with few issues right up to the release of plasma 6.5. And I can find nothing about what changed, even though this had to have been something pretty notable.

Offline

#8 2025-11-14 09:11:31

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 70,997

Re: desktop addWidget javascript blocks panel instantiation in theme

I believe I'm missing something more fundamental, like … What on earth did they change in plasma 6.5 that changed something so fundamental?

They introduced a bug?

I'd try to
1. hardcode the screengeometry driven variables (everywhere)
2. limit the widgets to one desktop (0 and 1) and see whether the panel shows up everywhere else

Offline

Board footer

Powered by FluxBB