git.lucas.co / cce-notifier
notification daemon
git clone https://git.lucas.co/cce-notifier.git

commit4621083dec1dd07031b83a651f1dcc8fe309e022
parent87214c32c7
authorLucas Galante <[email protected]>
date2026-07-07 12:37
refactor: read config values via cce_ui::config typed getters

Replace load_config + .pointer() accessors with config::get_i64/get_f32.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

 src/main.rs | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 2e6251d..3e893aa 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -455,13 +455,11 @@ fn play_bell_if_configured() {
 }
 
 fn read_duration_if_configured() -> u64 {
-    let val = load_config();
-    val.pointer("/notifications/duration").and_then(|v| v.as_u64()).unwrap_or(5)
+    cce_ui::config::get_i64("/notifications/duration", 5) as u64
 }
 
 fn read_opacity_if_configured() -> f32 {
-    let val = load_config();
-    val.pointer("/notifications/opacity").and_then(|v| v.as_f64()).map(|n| n as f32).unwrap_or(0.9)
+    cce_ui::config::get_f32("/notifications/opacity", 0.9)
 }
 
 fn read_bg_color_if_configured() -> [f32; 4] {