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
35
iso/airootfs/etc/skel/.config/hypr/scripts/input/binds.lua
Normal file
35
iso/airootfs/etc/skel/.config/hypr/scripts/input/binds.lua
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
-- scripts/input/binds.lua — loads binds.json into { default_mods, bindings }.
|
||||
-- Simpler than the multi-keyboard-layout version some personal configs use
|
||||
-- (BOS ships one fixed layout, no per-layout bind switching needed): just
|
||||
-- reads `default_mods` + the flat `bindings` array.
|
||||
|
||||
local json = dofile(os.getenv("HOME") .. "/.config/hypr/scripts/lib/json.lua")
|
||||
|
||||
local function normalize_mods(value, fallback)
|
||||
local mods = {}
|
||||
if type(value) == "table" then
|
||||
for _, item in ipairs(value) do
|
||||
if type(item) == "string" and item ~= "" then
|
||||
mods[#mods + 1] = item
|
||||
end
|
||||
end
|
||||
end
|
||||
if #mods == 0 then
|
||||
for _, mod in ipairs(fallback or {}) do
|
||||
mods[#mods + 1] = mod
|
||||
end
|
||||
end
|
||||
return mods
|
||||
end
|
||||
|
||||
return function(configPath)
|
||||
local parsed = json.load(configPath)
|
||||
if type(parsed) ~= "table" then
|
||||
return { default_mods = { "SUPER" }, bindings = {} }
|
||||
end
|
||||
|
||||
return {
|
||||
default_mods = normalize_mods(parsed.default_mods, { "SUPER" }),
|
||||
bindings = type(parsed.bindings) == "table" and parsed.bindings or {},
|
||||
}
|
||||
end
|
||||
124
iso/airootfs/etc/skel/.config/hypr/scripts/input/keybinds.lua
Normal file
124
iso/airootfs/etc/skel/.config/hypr/scripts/input/keybinds.lua
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
-- scripts/input/keybinds.lua — turns binds.json entries into real hl.bind()
|
||||
-- calls. Ported from a personal modular Hyprland config using the same
|
||||
-- `hl` API; action_builders covers every dispatcher shape BOS's keybinds
|
||||
-- actually use (exec, window management, focus/move/resize, workspaces,
|
||||
-- mouse, media keys).
|
||||
return function(ctx)
|
||||
local function split_mods(value)
|
||||
local mods = {}
|
||||
for raw_mod in tostring(value):gmatch("[^+]+") do
|
||||
local mod = raw_mod:gsub("^%s+", ""):gsub("%s+$", "")
|
||||
if mod ~= "" then
|
||||
mods[#mods + 1] = mod
|
||||
end
|
||||
end
|
||||
return mods
|
||||
end
|
||||
|
||||
-- `allow_empty`: an explicit `"mods": []` in binds.json (media keys,
|
||||
-- which must bind with no modifier at all) must NOT fall back to
|
||||
-- default_mods — only an *omitted* `mods` field should.
|
||||
local function normalize_mods(value, fallback, allow_empty)
|
||||
if value == nil then
|
||||
return fallback
|
||||
end
|
||||
if type(value) ~= "table" then
|
||||
return fallback
|
||||
end
|
||||
if #value == 0 then
|
||||
return allow_empty and {} or fallback
|
||||
end
|
||||
local mods = {}
|
||||
for _, item in ipairs(value) do
|
||||
if type(item) == "string" then
|
||||
for _, mod in ipairs(split_mods(item)) do
|
||||
mods[#mods + 1] = mod
|
||||
end
|
||||
end
|
||||
end
|
||||
if #mods == 0 then
|
||||
return fallback
|
||||
end
|
||||
return mods
|
||||
end
|
||||
|
||||
local defaultMods = normalize_mods(ctx.default_mods, { "SUPER" }, false)
|
||||
local bindings = ctx.bindings or {}
|
||||
|
||||
local function bind_string(mods, key)
|
||||
if type(key) ~= "string" or key == "" then
|
||||
return nil
|
||||
end
|
||||
if #mods == 0 then
|
||||
return key
|
||||
end
|
||||
return table.concat(mods, " + ") .. " + " .. key
|
||||
end
|
||||
|
||||
local action_builders = {
|
||||
exec = function(entry)
|
||||
return hl.dsp.exec_cmd(entry.command)
|
||||
end,
|
||||
close = function()
|
||||
return hl.dsp.window.close()
|
||||
end,
|
||||
exit = function()
|
||||
return hl.dsp.exit()
|
||||
end,
|
||||
float = function()
|
||||
return hl.dsp.window.float({ action = "toggle" })
|
||||
end,
|
||||
fullscreen = function()
|
||||
return hl.dsp.window.fullscreen({ action = "toggle" })
|
||||
end,
|
||||
pseudo = function()
|
||||
return hl.dsp.window.pseudo({ action = "toggle" })
|
||||
end,
|
||||
layout = function(entry)
|
||||
return hl.dsp.layout(entry.layout)
|
||||
end,
|
||||
focus = function(entry)
|
||||
return hl.dsp.focus({ direction = entry.direction, workspace = entry.workspace })
|
||||
end,
|
||||
focus_last = function()
|
||||
return hl.dsp.focus({ urgent_or_last = true })
|
||||
end,
|
||||
move = function(entry)
|
||||
return hl.dsp.window.move({ workspace = entry.workspace })
|
||||
end,
|
||||
move_dir = function(entry)
|
||||
return hl.dsp.window.move({ direction = entry.direction })
|
||||
end,
|
||||
resize = function()
|
||||
return hl.dsp.window.resize()
|
||||
end,
|
||||
resize_dir = function(entry)
|
||||
return hl.dsp.window.resize({ x = entry.x or 0, y = entry.y or 0, relative = true })
|
||||
end,
|
||||
drag = function()
|
||||
return hl.dsp.window.drag()
|
||||
end,
|
||||
}
|
||||
|
||||
-- One bad entry (unknown action, missing field a builder needs) must
|
||||
-- never take down every other bind — skip it and keep going instead of
|
||||
-- asserting/erroring, which would abort binds.json loading entirely.
|
||||
for _, entry in ipairs(bindings) do
|
||||
local builder = action_builders[entry.action]
|
||||
if builder then
|
||||
local ok, result = pcall(function()
|
||||
local mods = normalize_mods(entry.mods, defaultMods, true)
|
||||
local bind = bind_string(mods, entry.key)
|
||||
local action = builder(entry)
|
||||
if bind and action then
|
||||
hl.bind(bind, action, entry.options)
|
||||
end
|
||||
end)
|
||||
if not ok then
|
||||
print("breadhelp/hyprland: skipping bad bind entry (" .. tostring(entry.action) .. "/" .. tostring(entry.key) .. "): " .. tostring(result))
|
||||
end
|
||||
else
|
||||
print("breadhelp/hyprland: skipping bind entry with unknown action: " .. tostring(entry.action))
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue