Repository navigation
Fix Display panel display toggle using rejected hyprctl keyword - #13725
Conversation
Under the Lua config system, 'hyprctl keyword monitor ...' is rejected
("keyword can't work with non-legacy parsers") yet still exits 0, so the
panel's enable/disable row silently did nothing. Use the hl.monitor eval
API instead, as omarchy-hyprland-monitor-scaling already does.
The re-enable must pass disabled = false explicitly: hl.monitor rules
merge, so a disabled = true already in config (e.g. the
internal-monitor-disable toggle file) otherwise survives and the
re-enable no-ops.
|
Switching to Blocking (defense in depth): the connector name is still interpolated into a Lua string with no runtime check: var expr = enabled
? 'hl.monitor({ output = "' + name + '", disabled = true })'
: 'hl.monitor({ output = "' + name + '", disabled = false, mode = "preferred", position = "auto", scale = "auto" })'
actionProc.command = ["hyprctl", "eval", expr]The comment says names match if (!/^[A-Za-z0-9._-]+$/.test(name)) return
var expr = enabled
? 'hl.monitor({ output = "' + name + '", disabled = true })'
: 'hl.monitor({ output = "' + name + '", disabled = false, mode = "preferred", position = "auto", scale = "auto" })'
actionProc.command = ["hyprctl", "eval", expr] |
Hyprland lets a headless output take any name (`hyprctl output create headless <name>`), so a name with a quote broke out of the Lua string and the toggle failed for that output. Escape backslashes and quotes instead of asserting a character set the names do not actually follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
|
| var output = '"' + name.replace(/[\\"]/g, "\\$&") + '"' | ||
| var expr = enabled | ||
| ? 'hl.monitor({ output = ' + output + ', disabled = true })' | ||
| : 'hl.monitor({ output = ' + output + ', disabled = false, mode = "preferred", position = "auto", scale = "auto" })' |
There was a problem hiding this comment.
Re-enable resets display scale
When a user re-enables a display after setting a numeric scale through the panel, this command applies scale = "auto" instead of the saved scale. The live display can then use a different scale from the value saved for the monitor and GDK_SCALE, until the configuration is reapplied.
| var expr = enabled | ||
| ? 'hl.monitor({ output = ' + output + ', disabled = true })' | ||
| : 'hl.monitor({ output = ' + output + ', disabled = false, mode = "preferred", position = "auto", scale = "auto" })' | ||
| actionProc.command = ["hyprctl", "eval", expr] |
There was a problem hiding this comment.
Toggle lacks regression coverage
Neither branch of the panel’s new eval command has an automated test. A focused test of the generated arguments, especially disabled = false on re-enable, would help catch another silent toggle failure; the existing monitor tests cover shell-script callers, not this panel action.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Reviewed and verified, with one small fix pushed to your branch. The bug is real. On a worker built from the Omarchy ISO (Hyprland 0.56.2, Lua config) with a second headless output, Pushed: e0b0f34, escaping the output name. The comment said connector names always match Tests, on the worker at e0b0f34: Second opinion: Codex Medium reviewed the change twice. The first round found the quoting issue above and confirmed that The change is proportionate: one function, the same CI (Greptile) has passed on e0b0f34. Nothing is left for you to do. This is waiting on the maintainer. |
The toggle keeps upstream's escaped hl.monitor eval from omacom#13725. The built-in panel goes through omarchy-hyprland-monitor-internal instead, so the choice holds through reloads and clamshell, and while the display module arranges displays an external one goes through it, so it stays off through later rules and comes back where it was. The port's displayToggleCommand helper goes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fix Display panel display toggle using rejected hyprctl keyword (cherry picked from commit 2b2d462)
Problem
The Display panel's per-display enable/disable toggle (the monitors row) silently does nothing on current Omarchy.
Panel.qmlbuilds the toggle command with the hyprlang-era CLI:Under the Lua config system,
hyprctl keywordis rejected:Worse,
hyprctl keywordexits 0 despite the rejection, so the panel'sProcessreports success and the UI gives no feedback. Reproduced on Omarchy 4.0.4 (Hyprland with Lua config): clicking the checkbox for any display never changes its state.Fix
Drive the monitor through the
hl.monitoreval API instead — the same mechanismomarchy-hyprland-monitor-scalingalready uses:Two details worth noting:
disabled = falsemust be explicit on re-enable:hl.monitorrules merge, so without it adisabled = truealready in config (e.g. theinternal-monitor-disabletoggle file fromomarchy hyprland monitor internal off) survives and the re-enable silently no-ops.namecomes fromhyprctl monitorsJSON and matches^[A-Za-z0-9._-]+$, so interpolating it into the eval string is safe.Verification
Verified live on Omarchy 4.0.4 with the stock panel cloned to a user plugin (
omarchy plugin clone omarchy.monitor) and this patch applied:hyprctl eval 'hl.monitor({ output = "eDP-1", disabled = true })'→eDP-1drops out ofhyprctl monitors(previously: no-op).disabled = falsevariant bringseDP-1back at preferred/auto/auto (the plain variant withoutdisabled = falsedoes not — see above).Local plugin changed, reloading) with no QML errors; panel still summons and refreshes state fromomarchy monitor state.Semantics are unchanged from the original intent: runtime-only toggle (no persistence), same guard against disabling the last enabled display.
Tests
./test/all:config-test,snapper-test, andunowned-system-paths-testfail identically on a cleanquattrocheckout (pre-existing);sleep-lock-testflips pass/fail across runs on both branches (flaky). None are related to this change.