Fix Display panel display toggle using rejected hyprctl keyword

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.
This commit is contained in:
Junjie Hou committed 2026-09-29 14:30:22 +08:00
1 parent 9d61915b2e
commit 1095f73aa6
1 file changed
+7 -1
+7 -1
View File
@@ -300,7 +300,13 @@ Panel {
if (!name) return
if (enabled && root.enabledDisplayCount <= 1) return
actionProc.command = ["hyprctl", "keyword", "monitor", name + (enabled ? ",disable" : ",preferred,auto,auto")]
// hyprctl keyword is rejected under the Lua config ("non-legacy parsers"),
// so drive the monitor through the hl.monitor eval API instead. Connector
// names come from hyprctl itself and match ^[A-Za-z0-9._-]+$.
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]
if (!actionProc.running) actionProc.running = true
}