Honour XDG_CONFIG_HOME in Hyprland Lua loaders #96
No reviewers
Labels
No labels
P0
P1
P2
P3
audio
bakery
boot
breadbug
bug
build
ci
dependencies
design
disk
docs
encryption
final
firewall
graphics
hardware
idle
installer
keybinds
nvidia
packages
phase-1
polish
recovery
reliability
reproducibility
secure-boot
security
shell
signing
snapshots
supply-chain
swap
tech-debt
theming
ux
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Breadway/bos!96
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/bos-82-lua-xdg-config-home"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
How it was found
BOS-82 (medium confidence, reported from a sandboxed nested Hyprland session). Confirmed from source:
hyprland.luaand five loaders (display/monitors.lua,input/binds.lua,system/autostart.lua,ui/rules.lua,ui/settings.lua) built paths fromos.getenv("HOME") .. "/.config/hypr/". bos-settings writes throughdirs::config_dir(), which honours XDG_CONFIG_HOME, so with XDG_CONFIG_HOME set, Settings writes never reached the files Hyprland reads.What changed
scripts/lib/paths.lua(new): the one place the config dir is resolved. Uses XDG_CONFIG_HOME when it is an absolute path (empty or relative values are ignored, trailing slashes trimmed), else$HOME/.config.hyprland.lua: loads paths.lua from its own directory and setsBOS_HYPR_DIRonce.script_dir,config_homeand the nvidia.lua path use it.BOS_HYPR_DIRinstead of their own$HOMEstring.scripts/test-hypr-config-home.lua(new): standalone check, runs under plain lua or luajit, no Hyprland. Stages a copy of the shipped tree twice (XDG and HOME), loadshyprland.luawith a stubbedhlAPI, fireshyprland.start, and asserts each JSON read comes from the right dir. Also asserts no loader builds$HOME/.configitself.Behaviour is unchanged when XDG_CONFIG_HOME is unset.
Tests
lua scripts/test-hypr-config-home.lua: 18 passed, 0 failed.luajit scripts/test-hypr-config-home.lua: 18 passed, 0 failed.luac -p/ loadfile syntax check on every hypr Lua file: pass.hlAPI means this checks paths and load order, not Hyprland's acceptance of the values.Refs BOS-82
Unverified assumption (found after the PR was opened): hyprland.lua locates scripts/lib/paths.lua with debug.getinfo(1, "S").source. That only works if Hyprland loads the config as a file chunk (source starting with "@"). If Hyprland loads it from a string, the fallback is "." and dofile fails at the top of hyprland.lua, which would stop the whole config. The standalone test loads the file directly, so it does not cover this. Not verified against a live or nested Hyprland. Needs a check in a private nested session before merge, or a fallback to the XDG/HOME rule if source is not a path.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.