Escape the output name in the Display panel's hl.monitor eval
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 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
This commit is contained in:
1 parent
1095f73aa6
commit
e0b0f349f8
1 file changed
+4
-4
@@ -301,11 +301,11 @@ Panel {
|
||||
if (enabled && root.enabledDisplayCount <= 1) return
|
||||
|
||||
// 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._-]+$.
|
||||
// so drive the monitor through the hl.monitor eval API instead.
|
||||
var output = '"' + name.replace(/[\\"]/g, "\\$&") + '"'
|
||||
var expr = enabled
|
||||
? 'hl.monitor({ output = "' + name + '", disabled = true })'
|
||||
: 'hl.monitor({ output = "' + name + '", disabled = false, mode = "preferred", position = "auto", scale = "auto" })'
|
||||
? 'hl.monitor({ output = ' + output + ', disabled = true })'
|
||||
: 'hl.monitor({ output = ' + output + ', disabled = false, mode = "preferred", position = "auto", scale = "auto" })'
|
||||
actionProc.command = ["hyprctl", "eval", expr]
|
||||
if (!actionProc.running) actionProc.running = true
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user