bos-settings 0.4.1: fix broken panels, add breadsearch view
- breadbox panel edited [[contexts]] but breadbox reads [[context]]
(serde rename mismatch) — panel was always empty and Save appended
a dead array.
- Packages panel parsed installed.json as a flat map instead of
unwrapping {"packages": {...}} — always showed one bogus row.
- load_doc silently produced an empty document on any parse error,
so the next Save could clobber a config file with a syntax typo;
now backs it up first.
- Hyprland panel opened hyprland.conf/keybinds.conf (BOS ships
hyprland.lua) via $EDITOR with no terminal (dead click for any TUI
editor) and defaulted to foot (BOS ships kitty). Now opens
hyprland.lua and a keybinds cheat sheet via kitty -e $EDITOR.
- New breadsearch view: power (enabled/run-on-battery), compute
backend (cpu/npu/rocm), index/search settings.
This commit is contained in:
parent
4edd356151
commit
81f2f3545a
10 changed files with 176 additions and 31 deletions
|
|
@ -1,7 +1,9 @@
|
|||
//! breadbox config.toml — launcher contexts.
|
||||
//! Schema mirrors breadbox-shared (`[[contexts]]` with `name` + `priority`, an
|
||||
//! ordered list of app/category hints). The contexts array is rewritten on
|
||||
//! save; any other top-level keys/comments in the file are preserved.
|
||||
//! Schema mirrors breadbox-shared (`#[serde(rename = "context")]` — the TOML
|
||||
//! key is `[[context]]`, singular, despite the Rust field being `contexts`),
|
||||
//! with `name` + `priority`, an ordered list of app/category hints. The
|
||||
//! context array is rewritten on save; any other top-level keys/comments in
|
||||
//! the file are preserved.
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
|
@ -25,7 +27,7 @@ fn config_path() -> std::path::PathBuf {
|
|||
}
|
||||
|
||||
fn read_contexts(doc: &DocumentMut) -> Vec<Context> {
|
||||
let Some(aot) = doc.get("contexts").and_then(Item::as_array_of_tables) else {
|
||||
let Some(aot) = doc.get("context").and_then(Item::as_array_of_tables) else {
|
||||
return Vec::new();
|
||||
};
|
||||
aot.iter()
|
||||
|
|
@ -53,7 +55,7 @@ fn write_contexts(doc: &mut DocumentMut, ctxs: &[Context]) {
|
|||
t.insert("priority", value(arr));
|
||||
aot.push(t);
|
||||
}
|
||||
doc.as_table_mut().insert("contexts", Item::ArrayOfTables(aot));
|
||||
doc.as_table_mut().insert("context", Item::ArrayOfTables(aot));
|
||||
}
|
||||
|
||||
fn rebuild_list(list: &ListBox, model: &Rc<RefCell<Vec<Context>>>) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue