Introduce Monitor Layout Manager#423
Conversation
|
I think @jeremypw has some experience in this codebase? |
|
Its been quite a while since I looked at this plug but I'll try to test this out this weekend. |
| } | ||
|
|
||
| public MonitorLayoutProfile? find_match_layout (string key) { | ||
| // Layouts format are 'a{sa{sa{sv}}}' |
There was a problem hiding this comment.
"a{sa{s(iiu)}}" should be simpler, we don't need the monitor properties be extensible, nor the extra boxing of using variant values.
There was a problem hiding this comment.
What if we want to persist addition properties in future?
|
I have the following error: It is because you are trying to handle multiple layouts, each with its own hash. Hence I also have the following error: Disabled monitor still overlap active ones. And once the mirror mode was activated, I could no longer deactivate it, as an error window alerting of bad configuration appeared and prevented validating. |
|
@leonardo-lemos Hi, if you're still interested in pursuing this, I suggest you break out the code cleanups in order to reduce the diff. I think you are going in the right direction - personally I do not have a problem with a separate class to encompass the layout/settings management - the existing manager is complicated enough as it is. If you prefer, I am willing to work on this as this plug needs some attention. |
@jeremypw Would you mind working on this? I have a newborn right now and don't have much time to dedicate to it. |
|
@leonardo-lemos Very understandable! I'll see what I can do to progress this. |
Fixes #418
Closes #412
Resolves #424
This PR introduces the
MonitorLayoutManagerclass to persist and restore monitor arrangements when changes occur.We rely on Mutter's
DisplayConfigD-Bus interface to detect monitor changes and retrieve the current monitor layout configuration (i.e., virtual monitors or CRTCs). However, there are some edge cases that cause layout issues:Clone Mode (Mirror Mode): When clone mode is enabled, Settings creates a single virtual monitor encompassing all physical monitors with identical coordinates (
x=0,y=0). When clone mode is disabled, Settings has no memory of the previous layout and falls back to overlapping display widgets, since all monitors share the same coordinates.Disabling Monitors: When a monitor is disabled, Mutter still reports its existence but omits its coordinates, as it’s no longer part of the active layout. This results in the disabled monitor’s widget overlapping another widget in the UI.
To address these issues, this PR introduces a
GSettingto persist monitor layout data, including each monitor's position and transformation. This allows us to restore previous layouts accurately, even after mode toggles or monitor disable events.Additionally, this PR modifies when the display overlay updates its widgets — now triggered only when monitor changes are detected, ensuring a more stable and consistent display configuration.