Skip to content

Fix the display panel's on/off rows under the Lua config parser - #10194

Open
kidskript3 wants to merge 1 commit into
omacom:quattrofrom
kidskript3:fix-monitor-panel-toggle
Open

Fix the display panel's on/off rows under the Lua config parser#10194
kidskript3 wants to merge 1 commit into
omacom:quattrofrom
kidskript3:fix-monitor-panel-toggle

Conversation

@kidskript3

Copy link
Copy Markdown

Fixes #10086.

The bug

The rows under DISPLAYS in the monitor panel do nothing. Clicking one leaves the display on, and nothing is reported anywhere.

Panel.qml toggles through the legacy syntax:

hyprctl keyword monitor <name>,disable

Omarchy configures Hyprland through the Lua parser, which refuses that outright — and hyprctl still exits 0, so the panel has nothing to react to:

$ hyprctl keyword monitor eDP-1,disable
keyword can't work with non-legacy parsers. Use eval.
$ echo $?
0

The fix

  • Toggle through hyprctl eval with an hl.monitor({ ... }) rule.
  • Spell out disabled = false when switching an output back on. Restating a mode alone returns ok and leaves an already-disabled output off.
  • Restore the layout. Scale and position can only be read dependably while an output is on, and coming back with "auto" for both re-places the display and drops a scaled one to 1. omarchy-monitor-state now carries scale, x and y per display, and the panel remembers the last values it saw while an output was on.

Rule building and remembering are pure functions in Model.js, so both are unit-tested rather than only reachable through the UI.

Tests

  • test/shell.d/monitor-test.sh — new assertions for monitorRule (disable, restore, and the auto fallback for an output never seen enabled) and rememberLayouts (records every enabled display, keeps the last layout of one that went off).
  • test/shell.d/monitor-state-test.sh — fixtures and the display-list expectations extended to the new fields.
  • Full test/shell run: 222 of 226 files pass. The four failures (bar-icon-geometry, config, snapper, unowned-system-paths) fail identically on an unmodified checkout of this branch point on this host.

Verified on hardware

Alienware m15 R7 — internal eDP-1 (2560x1440) plus an external 5120x1440 on DP-1, both at scale 1.25, Hyprland 0.56.2:

before   eDP-1 enabled=true  scale=1.25 at 4096x0
disable  hl.monitor({ output = "eDP-1", disabled = true })            -> ok
         eDP-1 enabled=false
enable   hl.monitor({ output = "eDP-1", disabled = false, mode = "preferred",
                      position = "4096x0", scale = 1.25 })            -> ok
after    eDP-1 enabled=true  scale=1.25 at 4096x0

hyprctl configerrors is empty throughout. The same sequence through hyprctl keyword changes nothing at all.

🤖 Generated with Claude Code

The rows called `hyprctl keyword monitor <name>,disable`, which the
non-legacy Lua parser refuses ("keyword can't work with non-legacy
parsers. Use eval.") while hyprctl still exits 0, so nothing surfaced and
the display never toggled.

Switch the toggle to `hyprctl eval` and spell out `disabled = false` when
an output comes back; restating a mode alone returns ok and leaves an
already-disabled output off.

Coming back on also has to land where it was. Scale and position can only
be read dependably while an output is on, and "auto" for both re-places
the display and drops a scaled one to 1, so `omarchy-monitor-state` now
carries each display's scale and position and the panel remembers the last
values it saw while an output was on.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display panel cannot toggle monitors: uses hyprctl keyword, which the Lua parser rejects (exit 0)

1 participant