https://bugs.kde.org/show_bug.cgi?id=362511

Gary <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #5 from Gary <[email protected]> ---
Adding a data point from writing a desktop layout tool against this, plus the
failure mode, which I don't think is recorded here yet.

The gap is not only that geometry is unavailable -- it is that both ways of
attempting it fail without saying so.

    var d = desktops()[0];
    var w = d.addWidget("org.kde.plasma.quicklaunch");
    w.geometry = Qt.rect(40, 40, 520, 420);

throws "ReferenceError: Qt is not defined". The Qt object is not exposed in the
scripting engine's global scope, so the form the API's shape implies cannot
even
be attempted.

    w.geometry = {x: 40, y: 40, width: 520, height: 420};
    print(w.geometry.x);   // not 40

produces no error at all. The assignment is discarded, and reading the property
back returns the auto-placed position. That read-back is what costs the time:
it
looks exactly as though Plasma accepted the value and then re-laid out over the
top of it, so you go hunting for a layout policy to opt out of rather than
concluding the setter is a no-op. It is consistent with the observation above
that SetGeometry appears to be empty.

Even if implementing the setter is not on the cards, having the assignment
raise
instead of silently discarding would remove most of the cost here.

On the suggestion above of passing position arguments to addWidget(): as an API
for tools that would only solve half of it. Layout tools re-place widgets that
already exist, not only ones they are creating -- on every config change, and
again when the screen resolution changes, since the ItemGeometries key name
changes with it. Creation-time parameters would still leave "move this widget"
unavailable.

The only route that works today is to stop plasmashell, write
ItemGeometries-<W>x<H> under [Containments][<id>] in
plasma-org.kde.plasma.desktop-appletsrc in the Applet-<id>:x,y,w,h,0; format,
and start the shell again. plasmashell rewrites that file on exit, so the write
cannot happen while it is running. That is a private format behind a shell
restart, for a tool that only wants to position a widget.

Adjacent, in case it saves anyone else the detour: evaluateScript only reliably
returns print() output. A bare trailing expression usually comes back empty.

Operating System: Ubuntu 26.04 LTS (Kubuntu)
KDE Plasma Version: 6.6.6
KDE Frameworks Version: 6.24.0
Qt Version: 6.10.2
Graphics Platform: Wayland

Happy to test a patch against this if one appears.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to