Load workspace layout saves from the layouts directory - #9889
Load workspace layout saves from the layouts directory#9889fresh3nough wants to merge 3 commits into
Conversation
workspace-layouts.lua required omarchy.workspace-layouts.N while only HOME/.local/state was on package.path. With XDG_STATE_HOME set, or when bootstrap's HOME entry does not resolve the nested module, every Hyprland reload after a layout toggle raised module-not-found. Mirror toggles.lua: put the layouts directory on package.path and require bare filenames. Point the toggle script at XDG_STATE_HOME so saves match paths.state_home. Extend the workspace-layout shell test for both. Fixes omacom#9664 Signed-off-by: fresh3nough <anonwurcod@proton.me>
… default The toggle now derives its directory from XDG_STATE_HOME, and paths.lua always did, so a developer with that variable set in their own environment made the first case write into their real state directory and then fail on the tmpdir path it had just asserted. Clearing it is how agent-usage-update-test.sh keeps the same script hermetic. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…e fails lua reading a bare heredoc exits 0 even when the chunk raises: with the fix reverted, both loader checks printed the module-not-found error from omacom#9664 and still reported ok, so neither one proved the change it was added for. lua - and an explicit fail are how hyprland-qconsole-test.sh already handles this. Co-Authored-By: Codex XHigh <noreply@openai.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Reviewed by Claude Opus 5 in Claude Code and by Codex at xhigh reasoning, on a disposable Omarchy 4.0.0 worker with a real Hyprland session. Two defects found, both in the test file; both fixed and pushed to this branch. The production change is correct and I reproduced the bug and the fix on a live compositor. This does fix #9664, and the mechanism is not quite the one the PR describes. I reproduced it on a real compositor with
So the affected population is people whose [high] The two loader checks could not fail. [medium] The suite was not hermetic once the toggle started following [low] Bare module names resolve outside the layouts directory. With a Two things for the maintainer rather than for you, since they are judgement calls and I did not touch them:
One coverage gap left, if you want it: no test exercises the failure that was actually reported. The first loader check passes with or without the fix, because it runs the current bootstrap. Only the Tests: Waiting on the maintainer for the migration and convention questions above; nothing else blocking from me. |
Summary
Fixes #9664.
After
omarchy-hyprland-workspace-layout-togglewrites~/.local/state/omarchy/workspace-layouts/<id>.lua, every Hyprland reload could raise:workspace-layouts.luarequired a nested module prefix while bootstrap only putsHOME/.local/state/?.luaonpackage.path. That fails whenXDG_STATE_HOMEdiverges fromHOME/.local/state(and is fragile even when they match).toggles.luaalready avoids this by putting its directory onpackage.pathand requiring bare filenames.The toggle script also always wrote under
$HOME/.local/state, ignoringXDG_STATE_HOME, so saves could miss the directorypaths.state_homeuses to load.Change
default/hypr/workspace-layouts.lua: prependlayouts_dir/?.luaandrequire_all.files(..., nil, ...)(same pattern astoggles.lua)bin/omarchy-hyprland-workspace-layout-toggle: write under${XDG_STATE_HOME:-$HOME/.local/state}/omarchy/workspace-layoutsTest plan
test/shell.d/hyprland-workspace-layout-test.shXDG_STATE_HOMEand does not dual-write under HOMEworkspace-layoutsafter bootstraptoggles.luawhenXDG_STATE_HOMEdiverges from HOMEbash test/shell.d/hyprland-workspace-layout-test.sh— all passXDG_STATE_HOMEset,require("default.hypr.workspace-layouts")failed with module-not-found; post-fix loads the rule