Root cause of two panels rendering full-bleed instead of the 760px column (breadsearch, breadclip): hint()'s long unwrapped text reported an unbounded natural width, and CONTENT_MAX_WIDTH is a floor (set_size_request), not a cap — nothing was actually capping width. hint() and empty_state() now bound their labels with set_max_width_chars, which stabilizes every panel's column at a consistent width and left edge for the first time. service_control(): added a second status line (enabled-at-boot vs just-running), a confirm dialog on Stop for critical units (breadd — the whole desktop's event backbone was one accidental click from stopping, styled identically to optional helpers), and a consistent "Save only writes the file, Restart applies it" hint on panels that have both a service and a config file (previously only breadsearch said this, in its own inconsistent wording). Consistency sweep: Network's Scan button and empty-state treatment now match the rest of the app (was full-width where every other secondary action is auto-width; "not scanned" was a hint while "no results" was an empty_state card — now both empty_state). breadclip gets an actual "Open history" action instead of reading as an unfinished stub. breadbox's Save button pulled out of a mixed row into its own row like every other panel. Packages list rows now get the same card styling as every other row in the app. Panel title now shares view_scaffold's width+center treatment with the content column, so it actually heads the column instead of sitting ~440px to its left. Also: switch widgets had a stray box-shadow/outline/border showing as a faint ring around the knob, and bread-theme's switch slider color (@on-surface) was being masked by Adwaita's default gloss background-image — clearing it reveals the correctly-themed near-white knob against the dark surface.
160 lines
3.6 KiB
Rust
160 lines
3.6 KiB
Rust
//! breadd.toml — the bread daemon config.
|
|
//! Schema mirrors breadd/src/core/config.rs (daemon, lua, modules, adapters,
|
|
//! events, notifications). Edited non-destructively via the shared document.
|
|
|
|
use std::cell::RefCell;
|
|
use std::rc::Rc;
|
|
|
|
use gtk4::prelude::*;
|
|
use gtk4::Box as GBox;
|
|
|
|
use crate::config;
|
|
use crate::ui::widgets as w;
|
|
|
|
fn config_path() -> std::path::PathBuf {
|
|
config::config_dir().join("bread/breadd.toml")
|
|
}
|
|
|
|
pub fn build() -> GBox {
|
|
let path = config_path();
|
|
let doc = Rc::new(RefCell::new(config::load_doc(&path)));
|
|
|
|
let (outer, c) = w::view_scaffold("Daemon");
|
|
|
|
c.append(&w::service_control("breadd.service", true, true));
|
|
|
|
c.append(&w::section("Daemon"));
|
|
c.append(&w::dropdown_row(
|
|
"Log level",
|
|
&doc,
|
|
&["daemon", "log_level"],
|
|
&["error", "warn", "info", "debug", "trace"],
|
|
"info",
|
|
));
|
|
c.append(&w::entry_row(
|
|
"Socket path",
|
|
&doc,
|
|
&["daemon", "socket_path"],
|
|
"default (XDG runtime dir)",
|
|
"",
|
|
));
|
|
|
|
c.append(&w::section("Lua"));
|
|
c.append(&w::entry_row(
|
|
"Entry point",
|
|
&doc,
|
|
&["lua", "entry_point"],
|
|
"~/.config/bread/init.lua",
|
|
"",
|
|
));
|
|
c.append(&w::entry_row(
|
|
"Module path",
|
|
&doc,
|
|
&["lua", "module_path"],
|
|
"~/.config/bread/modules",
|
|
"",
|
|
));
|
|
|
|
c.append(&w::section("Modules"));
|
|
c.append(&w::switch_row(
|
|
"Load built-in modules",
|
|
&doc,
|
|
&["modules", "builtin"],
|
|
true,
|
|
));
|
|
c.append(&w::csv_row(
|
|
"Disabled modules",
|
|
&doc,
|
|
&["modules", "disable"],
|
|
"module-a, module-b",
|
|
));
|
|
|
|
c.append(&w::section("Adapters"));
|
|
c.append(&w::hint(
|
|
"Sources breadd normalises into events. Disable any you don't use.",
|
|
));
|
|
c.append(&w::switch_row(
|
|
"Hyprland",
|
|
&doc,
|
|
&["adapters", "hyprland", "enabled"],
|
|
true,
|
|
));
|
|
c.append(&w::switch_row(
|
|
"udev (devices)",
|
|
&doc,
|
|
&["adapters", "udev", "enabled"],
|
|
true,
|
|
));
|
|
c.append(&w::csv_row(
|
|
"udev subsystems",
|
|
&doc,
|
|
&["adapters", "udev", "subsystems"],
|
|
"usb, input, power_supply",
|
|
));
|
|
c.append(&w::switch_row(
|
|
"Power",
|
|
&doc,
|
|
&["adapters", "power", "enabled"],
|
|
true,
|
|
));
|
|
c.append(&w::spin_row(
|
|
"Power poll interval (s)",
|
|
&doc,
|
|
&["adapters", "power", "poll_interval_secs"],
|
|
1.0,
|
|
3600.0,
|
|
1.0,
|
|
30,
|
|
));
|
|
c.append(&w::switch_row(
|
|
"Network",
|
|
&doc,
|
|
&["adapters", "network", "enabled"],
|
|
true,
|
|
));
|
|
c.append(&w::switch_row(
|
|
"Bluetooth",
|
|
&doc,
|
|
&["adapters", "bluetooth", "enabled"],
|
|
true,
|
|
));
|
|
|
|
c.append(&w::section("Events"));
|
|
c.append(&w::spin_row(
|
|
"Dedup window (ms)",
|
|
&doc,
|
|
&["events", "dedup_window_ms"],
|
|
0.0,
|
|
10000.0,
|
|
50.0,
|
|
250,
|
|
));
|
|
|
|
c.append(&w::section("Notifications"));
|
|
c.append(&w::spin_row(
|
|
"Default timeout (ms)",
|
|
&doc,
|
|
&["notifications", "default_timeout_ms"],
|
|
0.0,
|
|
60000.0,
|
|
500.0,
|
|
5000,
|
|
));
|
|
c.append(&w::dropdown_row(
|
|
"Default urgency",
|
|
&doc,
|
|
&["notifications", "default_urgency"],
|
|
&["low", "normal", "critical"],
|
|
"normal",
|
|
));
|
|
c.append(&w::entry_row(
|
|
"notify-send path",
|
|
&doc,
|
|
&["notifications", "notify_send_path"],
|
|
"auto-detected",
|
|
"",
|
|
));
|
|
|
|
outer.append(&w::save_button(&doc, path));
|
|
outer
|
|
}
|