bos/iso/airootfs/etc/skel/.config/hypr/scripts/system/autostart.lua
Breadway 664298b6b4 Extract bos-settings to its own repo; add breadhelp; JSON-driven Hyprland config
bos-settings moves to git.breadway.dev/Breadway/bos-settings (full history
preserved via git-filter-repo) so its release cadence is decoupled from
BOS's own. breadhelp takes its place as this repo's workspace member: a
GTK4 onboarding/help center replacing the old bos-welcome/bos-keybinds
bash scripts with searchable guides, an interactive keybind viewer
(sourced from the new keybinds.toml, not parsed out of hyprland.lua or
hardcoded), a troubleshooting wizard with one-click fixes, and a proper
first-run tour. bos-netcheck extracts bos-welcome's network-check half,
which still needs to run every login independent of breadhelp's own
first-run gating.

hyprland.lua's keybinds/settings/monitors/autostart are now JSON-driven
(binds.json/settings.json/monitors.json/autostart.json) with every
loader pcall-wrapped and falling back to hardcoded defaults per field on
bad or missing config, so bread* apps (bos-settings' new editors, and
breadhelp's keybind viewer) can read/write this config without ever
being able to leave the compositor unable to start.

CI's package.yml now builds breadhelp instead of bos-settings on tag
push; bos-settings needs its own equivalent workflow in its new repo
(not yet set up).
2026-07-05 09:16:14 +08:00

45 lines
1.8 KiB
Lua

-- scripts/system/autostart.lua — loads the *extra* (user-toggleable)
-- autostart list from autostart.json. Returns just the enabled commands, in
-- order. The core bootstrap sequence (theme generation, dark-mode gsettings,
-- polkit agent, wallpaper daemon, breadd's Wayland-env fix, breadclipd) is
-- deliberately NOT exposed here — it's timing/order-sensitive infrastructure,
-- not something a settings UI should let a user disable, so it stays
-- hardcoded in hyprland.lua itself.
--
-- Failsafe: unlike monitors.json, an empty or all-disabled result here is a
-- legitimate user choice (they don't want breadbar/hypridle/etc), so this
-- only falls back to defaults on a missing/malformed file — never just
-- because the valid result happens to be empty.
local json = dofile(os.getenv("HOME") .. "/.config/hypr/scripts/lib/json.lua")
local DEFAULT_EXTRA = {
{ command = "breadbar", enabled = true },
{ command = "hypridle", enabled = true },
{ command = "bos-netcheck", enabled = true },
{ command = "breadhelp --autostart", enabled = true },
}
return function()
local path = os.getenv("HOME") .. "/.config/hypr/autostart.json"
local parsed = json.load(path)
local entries
if type(parsed) ~= "table" or type(parsed.extra) ~= "table" then
entries = DEFAULT_EXTRA
else
entries = parsed.extra
end
local commands = {}
for _, entry in ipairs(entries) do
if type(entry) == "table" and type(entry.command) == "string" and entry.command ~= "" then
local enabled = entry.enabled
if type(enabled) ~= "boolean" then
enabled = true
end
if enabled then
commands[#commands + 1] = entry.command
end
end
end
return commands
end