Repository navigation
Display key Hyprland profiles by serial for identical monitors - #4138
Conversation
|
/claude review |
Claude reviewOne fix needed before merge: the migration can tie a profile to the wrong monitor.
|
|
The migration in OutputModel.js now only renames keys when a profile’s monitor models exactly match what’s connected. Profiles for any other setup stay as they are. I rewrote the migration test to cover this case; it fails on the old code and passes now. Make test-qml passes. I didn’t rerun make lint-qml, because no QML files changed and it doesn’t check .js files. I also did not run any practical test on my own setup. There is one limit that remains: it can't tell two monitors of the same model apart when the set of models matches. The old key never recorded a serial, so this can’t be fully solved. The only way to avoid it is to drop the migration and have people set their layout once more. |
|
/claude review |
Claude reviewThe earlier finding is fixed, but the migration as wired never runs at startup.
|
| entry.id = generateProfileId(); | ||
| dirty = true; | ||
| } | ||
| if (CompositorService.isHyprland && OutputModel.migrateHyprlandProfileKeys(entry, outputs, SettingsData.displayNameMode)) |
There was a problem hiding this comment.
At startup this runs while outputs is still {}, so in practice the migration never happens.
validateProfiles() only runs when monitors.json is loaded. The FileView loads it with blockLoading while DMSShell's Component.onCompleted touches the singleton. outputs is filled later, after WlrOutputService gets wlroutput.getState back over the socket. With no outputs, the fingerprint check here always fails and the function returns false. Once the outputs arrive, onOutputsChanged → applyAutoConfig() searches with the new serial keys. The legacy auto profile doesn't match, so a new one is created. Named legacy profiles are never migrated, because self-writes don't trigger validateProfiles() again.
Fix: also run the migration when the outputs arrive, before profiles are matched. For example, in applyAutoConfig(), run it over data.configurations before findConfigEntryByFingerprint and write monitors.json if anything changed. Alternatively, call validateProfiles() from onOutputsChanged on Hyprland.
|
Calling validateProfiles() from onOutputsChanged on Hyprland would probably be the easiest of the two suggested, although it should be said that either leaves the limitation I pointed to earlier. The simplest solution would be removing the migration, but that means everyone on Hyprland that uses model mode would need to set their layouts once again. Which would you prefer? |
port 2.1 (cherry picked from commit 9621bec)
Description
On Hyprland in Model mode, profile keys now include the serial, matching the way it's done for niri. Monitors without a serial keep their old key. When the shell starts, old Make Model keys are renamed if exactly one connected monitor matches them, meaning a saved profile whose monitors are all different gets its keys updated automatically. A profile saved with two identical monitors can’t be sorted out after the fact, because the old key didn’t record which monitor was which. Those profiles stay as they are, and the user has to set the layout once more for a correct profile to be saved. I tested the fix with make test-qml, and included 2 new tests. I also tested locally with my laptop and two identical Philips 243V7s through a dock: the layout stayed correct across several replugs. I used Claude to write the fix, but reviewed and tested it myself.
Type of change
Related issues
Fixes #4116
Screenshots / video
Not applicable, no user-facing or visual change.
Checklist
I18n.tr()with translator context, reusing existing terms where possiblemake fmt, added/updated tests,make testpasses, andgo mod tidyis cleanmake lint-qmlwith no new warnings