panel: retry restoring panels whose monitor lags behind monitors-changed - #13915
Open
sergiuko83 wants to merge 1 commit into
Open
panel: retry restoring panels whose monitor lags behind monitors-changed#13915sergiuko83 wants to merge 1 commit into
sergiuko83 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
PanelManager._onMonitorsChanged()currently tries to recreate a panelwhose monitor previously went missing exactly once, synchronously, when
monitors-changedfires. This adds a small bounded retry (1s, 2s, 4s) forany panel still missing after that first pass, scoped only to the affected
panel IDs.
Why
Some outputs - USB-C / DisplayPort-alt-mode adapters in particular -
finish link training and EDID negotiation slower than native HDMI/DP. If
monitors-changedfires before the monitor is fully enumerated,global.display.get_n_monitors()is still stale, the existing singlerestore check fails, and nothing tries again automatically. The panel's
metadata is preserved (so it isn't destroyed), but the panel stays
invisible until the user manually adds a new panel on that monitor -
which happens to reuse the existing metadata - or an unrelated hotplug
event happens to fire
monitors-changedagain.Reported independently by multiple users in #12467, on hardware ranging
from docking-station USB-C setups to direct USB-C adapters, across
multiple Cinnamon versions (6.2.9 through at least 6.4.6), so this isn't
tied to one specific driver stack.
How
_scheduleMissingPanelRetry(id)is called only for panels that fail theexisting restore check. It re-checks
monitorCounton a short timer,retrying up to 3 times over ~7 seconds total, then gives up (leaving
things exactly as they behave today, i.e. no regression for genuinely
absent monitors). On success it calls the same
AppletManager.loadAppletsOnPanel/ layout-refresh calls the main restorepath already uses, so restored panels behave identically either way.
Testing
Reproduced on a laptop with a native HDMI port + a USB-C->HDMI adapter
driving a third external monitor. Before the patch: unplugging and
replugging the USB-C-adapter monitor reliably drops its panel, requiring
a manual "Add panel" to bring back the saved applet layout. After the
patch: the panel reliably reappears on its own within a few seconds of
reconnecting, with no manual step needed.
Risk
Purely additive - the existing single-shot restore path is unchanged.
Worst case for an unrelated regression: a panel that's genuinely supposed
to stay hidden (its monitor truly gone) gets a few harmless extra checks
over ~7 seconds before the retry loop gives up on its own; each check is
a no-op if the monitor still isn't present.
Fixes #12467