From f7b2ce7e3b1b7abeee61b2002b6b4b7c978c2464 Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Sun, 2 Apr 2023 21:10:12 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20fix=20user=20services=20status?= =?UTF-8?q?=20detection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/pages.rs b/src/pages.rs index 0c83cea..dac3dca 100644 --- a/src/pages.rs +++ b/src/pages.rs @@ -511,8 +511,10 @@ fn on_servbtn_clicked(button: >k::CheckButton) { signal_handler = *button.data("signalHandle").unwrap().as_ptr(); } - let local_units = &G_LOCAL_UNITS.lock().unwrap().enabled_units; - let cmd = if !local_units.contains(&String::from(action_data)) { + let units_handle = if action_type == "user_service" { &G_GLOBAL_UNITS } else { &G_LOCAL_UNITS } + .lock() + .unwrap(); + let cmd = if !units_handle.enabled_units.contains(&String::from(action_data)) { if action_type == "user_service" { format!("systemctl --user enable --now --force {action_data}") } else { @@ -542,8 +544,11 @@ fn on_servbtn_clicked(button: >k::CheckButton) { } Exec::shell(cmd).join().unwrap(); - load_global_enabled_units(); - load_enabled_units(); + if action_type == "user_service" { + load_global_enabled_units(); + } else { + load_enabled_units(); + } }); let button_sh = button.clone();