Repository navigation
Conversation
omarchy-hyprland-monitor-clamshell reads the internal panel's intended
scale and position out of monitors.lua, but only sees a rule written on a
single line and keyed by connector name. A rule keyed by desc: -- standard
Hyprland syntax, and the usual way to survive connectors renumbering -- and
a rule written across several lines -- what nwg-displays writes -- both
match nothing, so the panel silently falls back to the catch-all.
The watcher then re-applies the panel every couple of seconds with the
catch-all's values, discarding the position the user arranged, and on
clamshell exit re-enables it at the remembered-or-default scale rather than
the configured one.
Fold each hl.monitor({ ... }) call onto one line before matching, and look
the panel up by connector name first and then by any desc: rule whose text
prefixes its description, which is how Hyprland matches desc: itself.
Descriptions are EDID free text, so they are escaped before going into a
pattern. A panel that no rule names still falls through to the catch-all
exactly as before.
Fixes omacom#7084
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Reviewed at The bug is real and still on A competing fix is open: #7146. It fixes the same bug in the same file a different way. This pull request teaches the Codex compared the two at these same heads on 2026-09-28, while reviewing #7146, without being given an answer. It chose #7146. It also ran this branch's parser against other valid configs, and every one was still misread:
That comparison came from another item's review, and its independence from this session is not guaranteed. One thing in this pull request as it stands: the six cases in the description's Tests table are not in the diff. If the maintainer prefers this approach, they belong in Choosing between #7146 and this one is the maintainer's call. This is waiting on them. |
What's wrong?
omarchy-hyprland-monitor-clamshellreads the internal panel's intended scale and position out ofmonitors.lua, butmonitor_rule_regexonly matches a rule that is written on one line and keyed by connector name. Two shapes that Hyprland itself honours match nothing:desc:— standard Hyprland syntax, and the usual way to survive connectors renumbering across hotplug (Clamshell watcher ignores desc: rules for the internal panel and overwrites its scale every 2s #7084)nwg-displayswrites, and how a long rule tends to get hand-formatted (nwg-displays' multi-line hl.monitor() blocks break internal-panel scale sync (resets to 2) #8123, Internal monitor scale reverts to 2 when monitors.lua has multi-line hl.monitor({...}) entries #8335)The panel then falls through to the catch-all. Because the watcher re-applies the internal output every ~2s while docked, the user's arranged
positionis replaced withauto(#7326), and on clamshell exitenable_internal_outputre-enables the panel at the remembered-or-default scale instead of the configured one.Reproduction
Parser output for the same panel,
eDP-2, descriptionEDO EF10QBC64.C, againstmain(06e32d2):monitors.luaformconfigured_monitor_scaleread_monitor_position1.60x0desc:keyedautoautoautoautoOn real hardware with a
desc:-keyed multi-line rule,configured_monitor_scalereturns empty and the panel is driven from the fallback instead of the config.What this changes
monitor_rulesfolds eachhl.monitor({ ... })call onto a single line before matching, so a multi-line rule parses identically to the single-line form. Comment stripping still happens first, so a commented-out rule still cannot pose as a real one.internal_rule_keylooks the panel up by connector name first, then by anydesc:rule whose text is a prefix of the panel's description — which is how Hyprland matchesdesc:itself.regex_escapeguards the description before it goes into a pattern. Descriptions are EDID free text and routinely contain.,(,+.A panel that no rule names still falls through to the catch-all exactly as before, so the shipped default config behaves identically.
Tests
Six cases against the patched parser, including two negative controls:
1.6/0x01.6/0x0desc:keyedauto/auto1.6/0x0auto/auto1.6/0x0desc:prefix + multi-lineauto/auto1.6/0x01.25(catch-all)1.25unchanged1.251.25unchangedVerified on Omarchy 4.0.0-1 / Hyprland 0.56.2, Lenovo Legion 5 15IRX10, internal
eDP-22560x1600 (203 PPI) + externalHDMI-A-11920x1080 (102 PPI).Fixes #7084