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

            Bug ID: 525557
           Summary: Screen ids are positional, so an output add/remove
                    leaves panels and desktops bound to the wrong monitor
                    (or to none)
    Classification: Plasma
           Product: plasmashell
      Version First 6.7.5
       Reported In:
          Platform: CachyOS
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Panel
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: 1.0

Created attachment 196011
  --> https://bugs.kde.org/attachment.cgi?id=196011&action=edit
A quick patch that clanker threw together as a fix for reference.

Screen ids are positional, so an output add/remove leaves panels and desktops
bound to
the wrong monitor (or to none); a Task Manager on such a panel lists the wrong
screen's
windows and therefore looks empty. Only cloning the panel restores it.

STEPS TO REPRODUCE
1. Wayland session, 4 outputs (DP-5 2560x1600, HDMI-A-5 1920x1080, DP-4
2560x1600,
DP-3 2560x1600 @1.5), one panel per output, each with a Task Manager widget,
"Show only tasks from current screen" enabled.
2. Open a few windows, e.g. on DP-5 and DP-3.
3. kscreen-doctor output.DP-4.disable
4. kscreen-doctor output.DP-4.enable
(physically unplugging/replugging the monitor reproduces it as well, less
reliably)

OBSERVED
After step 3 the containment state reported through the Plasma scripting API
is:
panel 411 (recorded on DP-3): screen=-1
panel 548 (recorded on DP-4): screen=2  -> DP-3, i.e. the wrong output
desktop 353 (DP-4): screen=2 -> DP-3 ; desktop 354 (DP-3): screen=-1
connector ids: DP-5=0 HDMI-A-5=1 DP-3=2
journal for plasmashell:
requesting unexisting screen geometry 3
requesting unexisting screen available rect 3
requesting unexisting screen available rect -1   (repeats every 6 s while
broken)
With a panel that ends up on a screen whose geometry matches no window, that
panel's
Task Manager shows nothing at all (its other widgets are fine); cloning the
panel always
fixes it. After step 4 some containments stay mis-bound.

EXPECTED
Panels/desktops stay attached to the same physical output across hotplug, and a
Task
Manager keeps listing the windows of its own monitor.

ADDITIONAL INFORMATION
- ScreenPool returns ids as indices into the ordered output list
(screenpool.cpp:
idForScreen = indexOf, screenForId = m_availableScreens[id]), so ids change
meaning on
hotplug. Containments persist that number (Containment::reactToScreenChange
writes
lastScreen), and ShellCorona::handleScreenOrderChanged re-targets panel/desktop
views
by that stored number - nothing translates "the output that used to be #2" into
"the
output that is #2 now". Panels whose number is out of range never get a view
(checkAllPanelsUiReady), desktops get destroyed (handleScreenRemoved).
- The wrong monitor is then shown silently: Containment::screenGeometry() calls
corona()->screenGeometry(screen()), which for an invalid screen returns the
PRIMARY
screen's rect (only logging "requesting unexisting screen geometry"). The Task
Manager
feeds exactly that rect into TaskFilterProxyModel, which drops every window
whose own
screen rect differs and only disables itself when the rect is *invalid* - so
the widget
does not degrade to "all windows", it shows another monitor's list, or nothing.
With an empty model the applet shrinks to ~0 width, which is what the user
sees.
- Suggested fixes: (a) persist output identity (connector name or output UUID)
instead of
the index and resolve it at load, plus translate indices by name in
ScreenPool::handleUpdate / ShellCorona::handleScreenOrderChanged instead of
trusting the
old number; (b) independently, return an invalid QRect for a nonexistent screen
so the
screen filter switches itself off instead of filtering by the primary screen.
- Verified against current master: both the positional model and
sanitizeScreenLayout's
renumbering of lastScreen are still present, so this is not fixed by the 2026
ScreenPool
rework.

SOFTWARE/OS VERSIONS
Operating System: CachyOS (Arch), kernel 7.2.4
KDE Plasma Version: 6.7.5 (plasmashell 6.7.5, plasma-workspace 6.7.5-1.1)
KDE Frameworks Version: 6.30.0
Qt Version: 6.11.2
Graphics Platform: Wayland (KWin 6.7.5)
GPU: Intel/AMD hybrid (i7-8809G); all outputs driven by the AMD Vega M (card2)

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

Reply via email to