From 879298544ad1f074e85e1543efa1153533a4615d Mon Sep 17 00:00:00 2001 From: nokyan Date: Sat, 9 May 2026 18:16:27 +0200 Subject: [PATCH] Add cli arg to disable update halt on suspension --- src/gui.rs | 4 ++++ src/ui/widgets/graph.rs | 4 +++- src/ui/window.rs | 24 +++++++++++++----------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/gui.rs b/src/gui.rs index 480d2040..1643744f 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -52,6 +52,10 @@ pub struct Args { #[arg(short = 'p', long, default_value_t = false)] pub disable_process_monitoring: bool, + /// Do not pause graphical updates when the application is suspended + #[arg(short = 's', long, default_value_t = false)] + pub no_suspend_pause: bool, + /// Open tab specified by ID. /// Valid IDs are: "applications", "processes", "cpu", "memory", "gpu-$PCI_SLOT$", /// "drive-$MODEL_NAME_OR_DEVICE_NAME$", "network-$INTERFACE_NAME$", diff --git a/src/ui/widgets/graph.rs b/src/ui/widgets/graph.rs index 718307f5..0a7252a8 100644 --- a/src/ui/widgets/graph.rs +++ b/src/ui/widgets/graph.rs @@ -213,7 +213,9 @@ impl ResGraph { } pub fn queue_draw_if_not_suspended(&self) { - if Application::try_default() + if crate::gui::ARGS.no_suspend_pause { + self.imp().obj().queue_draw(); + } else if Application::try_default() .and_then(|app| app.try_main_window()) .map(|main_window| main_window.is_suspended()) .unwrap_or_default() diff --git a/src/ui/window.rs b/src/ui/window.rs index 72a96051..b61ff1c1 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -374,18 +374,20 @@ impl MainWindow { )); self.add_controller(event_controller); - self.connect_suspended_notify(clone!( - #[weak] - imp, - move |window| { - imp.pause_updates.set(window.is_suspended()); - if window.is_suspended() { - debug!("Resources has been suspended, halting graphical updates"); - } else { - debug!("Resources is not suspended anymore, resuming graphical updates"); + if !ARGS.no_suspend_pause { + self.connect_suspended_notify(clone!( + #[weak] + imp, + move |window| { + imp.pause_updates.set(window.is_suspended()); + if window.is_suspended() { + debug!("Resources has been suspended, halting graphical updates"); + } else { + debug!("Resources is not suspended anymore, resuming graphical updates"); + } } - } - )); + )); + } } fn get_selected_page(&self) -> Option {