Scaffold BOS repo: dotfiles, ISO profile, and bos-settings GTK4 app
Implements all four components from the BOS spec: - dotfiles/: default Hyprland, bread, breadbox, breadcrumbs configs - iso/: archiso profiledef, package list, Calamares YAML modules, post-install.sh - bos-settings/: Cargo workspace with GTK4 settings app (8 views: snapshots, packages, bread, breadbar, breadbox, breadcrumbs, breadpad, hyprland) https://claude.ai/code/session_01WszGHvCmxgcyTwNSkfLF9P
This commit is contained in:
parent
26d3bd8266
commit
0ff3998c84
38 changed files with 2547 additions and 0 deletions
24
bos-settings/src/config/mod.rs
Normal file
24
bos-settings/src/config/mod.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
use std::error::Error;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn load<T: for<'de> serde::Deserialize<'de>>(path: &Path) -> Result<T, Box<dyn Error>> {
|
||||
let text = std::fs::read_to_string(path)?;
|
||||
Ok(toml::from_str(&text)?)
|
||||
}
|
||||
|
||||
pub fn save<T: serde::Serialize>(path: &Path, val: &T) -> Result<(), Box<dyn Error>> {
|
||||
if let Some(parent) = path.parent() {
|
||||
std::fs::create_dir_all(parent)?;
|
||||
}
|
||||
std::fs::write(path, toml::to_string_pretty(val)?)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn config_dir() -> std::path::PathBuf {
|
||||
dirs_path()
|
||||
}
|
||||
|
||||
fn dirs_path() -> std::path::PathBuf {
|
||||
let home = std::env::var("HOME").unwrap_or_else(|_| "/root".to_string());
|
||||
std::path::PathBuf::from(home).join(".config")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue