From eb83bb3c380b707a2779b31ad2cffc08c8c94afe Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Sun, 15 Jun 2025 15:28:24 -0500 Subject: [PATCH] adding aider to gitignore and fixing padding --- .gitignore | 3 ++- src/main.rs | 66 ++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index d8f9ec7..ba0816d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ target/ -.direnv/ \ No newline at end of file +.direnv/ +.aider* diff --git a/src/main.rs b/src/main.rs index 802f46d..8bddb5c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -126,25 +126,26 @@ impl Panel { None } }; - ( - Self { - system: System::new_all(), - disks: Disks::new_with_refreshed_list(), - workspaces: workspaces.unwrap().to_vec(), - active_workspace: 1, - time: String::new(), - cpu: String::new(), - memory: String::new(), - disk: String::new(), - apps: vec![String::new()], - active_window, - active_window_icon_svg, - active_window_icon_raster, - battery, - system_tray: None, - }, - Task::none(), - ) + let mut app = Self { + system: System::new_all(), + disks: Disks::new_with_refreshed_list(), + workspaces: workspaces.unwrap().to_vec(), + active_workspace: 1, + time: String::new(), + cpu: String::new(), + memory: String::new(), + disk: String::new(), + apps: vec![String::new()], + active_window, + active_window_icon_svg, + active_window_icon_raster, + battery, + system_tray: None, + }; + + // let sys_task = Task::perform(app.add_sys_tray(), |app| app = app ); + + (app, Task::none()) } fn namespace(&self) -> String { String::from("panel") @@ -204,7 +205,13 @@ impl Panel { Message::ActiveWindowChange(w) => { debug!(?w); self.active_window = w.0; - let icon = lookup(&w.1) + let class; + if &w.1 == "lw" { + class = "LibreWolf"; + } else { + class = &w.1; + } + let icon = lookup(class) .with_theme("Papirus-Dark") .force_svg() .with_size(16) @@ -361,7 +368,11 @@ impl Panel { if let Some(handle) = &self.active_window_icon_svg { icon = svg(handle.clone()).width(16).height(16).into(); } else { - icon = image("/home/chris/pics/wojaks/reddit_the_xenomorph_s bigass wojak folder/Chads/ChristianChad.png").into(); + if let Some(handle) = &self.active_window_icon_raster { + icon = image(handle.clone()).width(16).height(16).into(); + } else { + icon = image("/home/chris/pics/wojaks/reddit_the_xenomorph_s bigass wojak folder/Chads/ChristianChad.png").width(16).height(16).into(); + } } let icon = container(icon).center(Length::Shrink).padding(4); @@ -433,6 +444,19 @@ impl Panel { text_color: theme.palette().text, } } + + async fn add_sys_tray(mut self) -> Self { + let sys_tray = SystemTray::new().await; + match sys_tray { + Ok(s) => { + self.system_tray = Some(s); + } + Err(e) => { + error!(?e, "Sys tray couldn't be initialized") + } + } + self + } } pub fn convert(num: f64) -> String {