Skip to content

Display key Hyprland profiles by serial for identical monitors - #4138

Merged
bbedward merged 3 commits into
duxlabs-dev:masterfrom
ThomasMeisters:hyprland-profile-serial
Nov 6, 2026
Merged

bbedward merged 3 commits into
duxlabs-dev:masterfrom
ThomasMeisters:hyprland-profile-serial

Conversation

@ThomasMeisters

@ThomasMeisters ThomasMeisters commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor / internal cleanup
  • Documentation
  • Other

Related issues

Fixes #4116

Screenshots / video

Not applicable, no user-facing or visual change.

Checklist

  • My code follows the conventions in CONTRIBUTING.md
  • I have tested my changes locally
  • [n/a] New user-facing strings are wrapped in I18n.tr() with translator context, reusing existing terms where possible
  • [ n/a] Go changes: ran make fmt, added/updated tests, make test passes, and go mod tidy is clean
  • QML changes: ran make lint-qml with no new warnings
  • [ n/a] I have opened a corresponding pull request in dux-docs to document any new behaviors: https://github.com/duxlabs-dev/dux-docs

@purian23

purian23 commented Nov 5, 2026

Copy link
Copy Markdown
Member

/claude review

Comment thread quickshell/Common/OutputModel.js Resolved
@claude

claude Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Claude review

One fix needed before merge: the migration can tie a profile to the wrong monitor.

  • The migration renames legacy keys in profiles that don't match the connected outputs, so a profile can get the serial of another monitor of the same model, quickshell/Common/OutputModel.js:81
    Checked: OutputModel.js identifier, matching and migration logic, the validateProfiles call site, HyprlandService and RefreshRateService identifier use, and the tests. Model: claude-opus-5-5.

@ThomasMeisters

Copy link
Copy Markdown
Contributor Author

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.

@bbedward

bbedward commented Nov 5, 2026

Copy link
Copy Markdown
Member

/claude review

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Claude review

The earlier finding is fixed, but the migration as wired never runs at startup.

  • Profiles are validated before the output state arrives over the socket, so outputs is empty and legacy Hyprland keys are never migrated, quickshell/Modules/Settings/DisplayConfig/DisplayConfigState.qml:649
    Checked: OutputModel.js identifier, matching and migration logic, the validateProfiles call site and startup ordering against WlrOutputService, HyprlandService and RefreshRateService identifier use, and the tests. Model: claude-opus-5-5.

entry.id = generateProfileId();
dirty = true;
}
if (CompositorService.isHyprland && OutputModel.migrateHyprlandProfileKeys(entry, outputs, SettingsData.displayNameMode))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ThomasMeisters

Copy link
Copy Markdown
Contributor Author

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?

@bbedward
bbedward merged commit 9621bec into duxlabs-dev:master Nov 6, 2026
5 checks passed
dux-ci Bot pushed a commit that referenced this pull request Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature fix ui Quickshell UI under quickshell/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hyprland: display profiles can't tell identical monitors apart (serial dropped from profile identifier)

3 participants