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).
This commit is contained in:
parent
434efcea22
commit
664298b6b4
105 changed files with 3280 additions and 5149 deletions
|
|
@ -0,0 +1,56 @@
|
|||
-- scripts/display/monitors.lua — loads monitors.json (an array of monitor
|
||||
-- rules) and applies each via hl.monitor(). Failsafe: an empty or entirely
|
||||
-- invalid monitors.json is treated the same as a missing one — falling back
|
||||
-- to the single generic wildcard rule — because applying *zero* monitor
|
||||
-- rules risks an unconfigured/black-screen session, unlike settings.json or
|
||||
-- autostart.json where "apply nothing extra" is a legitimate user choice.
|
||||
local json = dofile(os.getenv("HOME") .. "/.config/hypr/scripts/lib/json.lua")
|
||||
|
||||
local DEFAULT_MONITORS = {
|
||||
{ output = "", mode = "preferred", position = "auto", scale = "auto" },
|
||||
}
|
||||
|
||||
local function valid_entry(e)
|
||||
return type(e) == "table" and type(e.output) == "string"
|
||||
end
|
||||
|
||||
local function load_monitors()
|
||||
local path = os.getenv("HOME") .. "/.config/hypr/monitors.json"
|
||||
local parsed = json.load(path)
|
||||
if type(parsed) ~= "table" or type(parsed.monitors) ~= "table" then
|
||||
return DEFAULT_MONITORS
|
||||
end
|
||||
|
||||
local valid = {}
|
||||
for _, entry in ipairs(parsed.monitors) do
|
||||
if valid_entry(entry) then
|
||||
valid[#valid + 1] = {
|
||||
output = entry.output,
|
||||
mode = (type(entry.mode) == "string" and entry.mode) or "preferred",
|
||||
position = (type(entry.position) == "string" and entry.position) or "auto",
|
||||
scale = entry.scale ~= nil and entry.scale or "auto",
|
||||
mirror = type(entry.mirror) == "string" and entry.mirror or nil,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
if #valid == 0 then
|
||||
return DEFAULT_MONITORS
|
||||
end
|
||||
return valid
|
||||
end
|
||||
|
||||
local monitors = load_monitors()
|
||||
local applied_any = false
|
||||
for _, m in ipairs(monitors) do
|
||||
if pcall(hl.monitor, m) then
|
||||
applied_any = true
|
||||
end
|
||||
end
|
||||
|
||||
-- Every entry failed to apply (e.g. Hyprland rejected values that still
|
||||
-- passed our type checks) — guarantee a usable session rather than leaving
|
||||
-- every monitor unconfigured.
|
||||
if not applied_any then
|
||||
pcall(hl.monitor, DEFAULT_MONITORS[1])
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue