Pass config from main to the relevant places

This commit is contained in:
jmb05
2026-11-02 17:06:42 +01:00
parent de1f731e63
commit cdfc5b8d36
13 changed files with 170 additions and 107 deletions

View File

@@ -5,13 +5,13 @@ mod css;
mod ctl;
mod ui;
use crate::config::Config;
use glib::clone;
use gtk::prelude::*;
use gtk::{Application, CssProvider, gdk, gio};
use jmb_logger_rs::*;
use notify::RecommendedWatcher;
use std::cell::RefCell;
use std::process::Command;
use std::rc::Rc;
pub const LOGGER: Logger = Logger::create(Level::DEBUG);
@@ -20,16 +20,14 @@ pub const APP_NAME: &str = "net.jmb19905.jmb-bar";
fn main() {
info!(&LOGGER, "Starting jmb-bar");
gio::resources_register_include!("templates.gresource").expect("Failed to register resources");
let config = Config::load();
let backend = Backend::start(&config);
gio::resources_register_include!("templates.gresource").expect("Failed to register resources");
let app = Application::builder().application_id(APP_NAME).build();
let watcher_slot: Rc<RefCell<Option<RecommendedWatcher>>> = Rc::new(RefCell::new(None));
let _ = Command::new("pkill hypridle").output(); // Kill existing hypridle processes
let backend = Backend::start();
app.connect_startup(move |_| {
debug!(&LOGGER, "Connect startup");
let provider = CssProvider::new();