<span class="mw-page-title-main">Dump/SunJul19123155CEST2026</span>
Fabrice P. Laussπ•ͺ’s β„€eno-frozen Web
  1. Handoff: automate workaround for KDE bug 496251 (dead screen edges after mouse resize)
    1. Context

- System: TUXEDO OS, KDE Plasma **6.3.2**, **X11** session (`kwin_x11`), multi-monitor

 (laptop + external main display). User: laussy, home `/home/laussy`.

- Bug: with "Switch desktop on edge" enabled, **mouse-resizing any window

 systematically kills edge-triggered virtual desktop switching**. Keyboard desktop
 switching keeps working. Upstream: https://bugs.kde.org/show_bug.cgi?id=496251
 (open, no fix, no diagnosis). Related: bug 453040.
    1. Established facts (all tested by the user β€” do not re-litigate)

1. `qdbus org.kde.KWin /KWin reconfigure` does NOT cure it (even with a forced

  config delta). Edge *reservation* is intact; failure is downstream.

2. `ElectricBorderMaximize` / `ElectricBorderTiling` were already false β€”

  tiling-contention hypothesis is DEAD.

3. Manual cures that work: (a) right-click on desktop + Escape; (b) keyboard

  desktop switch; (c) **`wmctrl -r :ACTIVE: -b toggle,maximized_vert` β€” a single
  run cures it** (tested; note it leaves the window state toggled).

4. KWin scripting: a script hooking `interactiveMoveResizeFinished` (with

  `clientFinishUserMovedResized` legacy fallback) DOES load and fire on this
  system (v1.2 confirmed via journal). BUT an **internal** `frameGeometry`
  Β±1px nudge from the script does NOT cure. Conclusion: the cure must arrive
  via the **X11 event path** (external client message), not KWin-internal calls.

5. Logging: use `console.warn`, not `print` (filtered out). Journal:

  `journalctl --user -u plasma-kwin_x11 -f`.

6. Script loading that works on this machine (packaged loading via

  kwinrc Plugins group was silently broken; use this dev loop):
  ```
  qdbus org.kde.KWin /Scripting org.kde.kwin.Scripting.unloadScript edge-rearm
  qdbus org.kde.KWin /Scripting org.kde.kwin.Scripting.loadScript /home/laussy/.local/share/kwin/scripts/edge-rearm/contents/code/main.js edge-rearm
  qdbus org.kde.KWin /Scripting org.kde.kwin.Scripting.start
  ```

7. xdotool on this system is OLD: `windowsize` has **no `--relative`** option.

  Use `getwindowgeometry --shell` + absolute sizes.

8. User preference: every script gets a version number in its header, bumped on

  each revision. Code blocks: bare code only, no shell prompts.
    1. Goal

After every interactive (mouse) resize, automatically fire an X-side cure so the user never has to run anything manually. Architecture already designed:

KWin script (hook on resize-finished) β†’ `callDBus` β†’ kglobalaccel `invokeShortcut` β†’ custom shortcut running an external cure script.

    1. Tasks
      1. T1 β€” Find the least intrusive X-side cure (user must test each candidate)

Candidate A (invisible if it works): pure ConfigureRequest resize ```bash

  1. !/bin/bash
  2. edge-unstick.sh β€” v2.0

eval "$(xdotool getactivewindow getwindowgeometry --shell)" xdotool windowsize "$WINDOW" $((WIDTH + 1)) "$HEIGHT" xdotool windowsize "$WINDOW" "$WIDTH" "$HEIGHT" ``` Candidate B (state-neutral double toggle β€” verify double still cures, single is proven): ```bash wmctrl -r :ACTIVE: -b toggle,maximized_vert wmctrl -r :ACTIVE: -b toggle,maximized_vert ``` Test protocol per candidate: mouse-resize a window (breaks edges) β†’ run candidate β†’ push pointer to screen edge β†’ does desktop switch? Pick the least intrusive curing variant, install as `/home/laussy/bin/edge-unstick.sh`, chmod +x.

      1. T2 β€” Wire it to a global shortcut + D-Bus

- System Settings β†’ Shortcuts β†’ Add Command: `/home/laussy/bin/edge-unstick.sh`,

 name `edge-unstick`, assign any key (kept as manual backup).

- Discover component: `qdbus org.kde.kglobalaccel | grep -i component` - Verify cure via:

 `qdbus org.kde.kglobalaccel /component/<found> org.kde.kglobalaccel.Component.invokeShortcut "edge-unstick"`
 (break edges first, confirm this call cures).
      1. T3 β€” KWin glue script

`~/.local/share/kwin/scripts/edge-rearm/contents/code/main.js` (v1.3+; adjust COMPONENT to T2's discovery): ```javascript // edge-rearm v1.3 β€” KDE bug 496251 workaround (X11) var COMPONENT = "/component/edge_unstick"; // <-- adjust

function cure() {

   callDBus("org.kde.kglobalaccel", COMPONENT,
            "org.kde.kglobalaccel.Component", "invokeShortcut",
            "edge-unstick");
   console.warn("edge-rearm: external cure invoked");

}

function hook(w) {

   if (!w) { return; }
   if (w.interactiveMoveResizeFinished !== undefined) {
       w.interactiveMoveResizeFinished.connect(cure);
   } else if (w.clientFinishUserMovedResized !== undefined) {
       w.clientFinishUserMovedResized.connect(cure);
   }

}

workspace.windowList().forEach(hook); workspace.windowAdded.connect(hook); console.warn("edge-rearm v1.3 loaded"); ``` Load with the dev loop from fact 6. End-to-end test: mouse resize β†’ journal shows "external cure invoked" β†’ edge switching works immediately.

      1. T4 β€” Robustness (only after T3 works)

- Debounce: resize-finished may fire in bursts; add a ~200 ms guard if the cure

 runs multiple times per resize.

- Persistence: make the script survive KWin restarts β€” either fix packaged

 loading (metadata.json validation: `kpackagetool6 --type KWin/Script --show`)
 or add the loadScript sequence to an autostart script.

- Possible issue: kglobalaccel shortcut names with spaces/underscores β€” the

 component path and shortcut name must match exactly what kglobalaccel
 registered; inspect with `qdbus org.kde.kglobalaccel /component/<x> org.kde.kglobalaccel.Component.shortcutNames`.
    1. Constraints

- X11 only; do not propose Wayland (no XFixes/wmctrl there; user staying on X11

 for now).

- Do not propose `kwin_x11 --replace` (slow, buggy here) or Overview/Alt+E

 (slow) β€” those are the rituals this project replaces.

- The user will report test results; candidate selection in T1 is empirical,

 not decidable from code.
    1. Deliverables

1. Final `edge-unstick.sh` (versioned header). 2. Final `main.js` (versioned header) + metadata.json that loads via kpackagetool. 3. One-line summary of which cure variant proved least intrusive β€” the user

  will post it as a comment to KDE bug 496251.