Repository navigation
Conversation
Backport the launcher guards and regression coverage from omacom#14421 to the 4.5 maintenance branch, where the terminal launcher is still in use.
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryThe PR checks monitor and workspace names before using them in Hyprland commands.
The earlier whitespace-name finding is addressed by the NUL-separated read loop. No new actionable issues were found. Reviews (3) · Last reviewed commit: "launch-screensaver: hand focus back only..." · Reviewed by Greptile |
…them A monitor and its special workspace shared one space-separated line, so a headless output named "DP-1 extra" became a valid monitor and a valid workspace, both guards passed, and the launcher targeted the wrong one. A newline in the name split the record the same way. Read each field from its JSON record on its own, NUL between them, so a name arrives whole.
A compositor mid hotplug can report no focused monitor, and the close-time restore then refused the empty name with exit 1 after every screensaver had already opened. Skip the restore when the name is empty; a name that is there is still checked before it reaches the Lua dispatch.
|
Both review points are covered on
The name guards themselves are from |
|
Thanks for this! We ended up bringing 4.6's native screensaver to 4.5.1 in #19068 instead, so both release lines run the same one. The new |
What changes
On the 4.5 branch,
omarchy-launch-screensaverstill pastes the monitor name and the special-workspace name straight into the Lua expression it hands tohyprctl:Both values come from
hyprctl monitors -j. A name that is not a plain connector string closes the Lua string early, and this launcher has no validation, while the three monitor toggles next to it (omarchy-hyprland-monitor-clamshell,-scaling,-internal) gate the same names behind^[A-Za-z0-9._-]+$.quattrono longer has this code:fdbe182d3replaced the terminal launcher with the nativeomarchy-screensaveroverlay and deletedtest/shell.d/screensaver-workspace-test.sh. The 4.5 branch still uses the terminal launcher, so this backports the guards and their regression coverage there.require_safe_monitor_nameandrequire_safe_workspace_name, fail closed, in front ofhypr_focus_monitorandhypr_exec.^[A-Za-z0-9._-]+$and the sameif/echo ... >&2/exit 1shape the sibling toggles use.[,],;and control characters, while allowing real special names such asspecial:my stuff.test/shell.d/screensaver-workspace-test.shreads the monitor list from amonitors.jsonfixture so a payload travels through the samejqpipeline the real script uses, and asserts the launcher refuses it instead of dispatching it.Verification
12 ok, exit 0 on the 4.5 branch, with real
jq,luaandsocat;hyprctland the terminal are stubbed, as in the existing test. An empty focused monitor no longer dispatches a focus, and a name with a space or a newline is rejected instead of split. Not checked: a live compositor.Screenshots
No visible change: the launcher runs the same with a valid monitor name.