🚧 fix user services status detection

This commit is contained in:
Vladislav Nepogodin 2023-04-02 21:10:12 +04:00
parent a75b1a0280
commit f7b2ce7e3b
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
1 changed files with 9 additions and 4 deletions

View File

@ -511,8 +511,10 @@ fn on_servbtn_clicked(button: &gtk::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: &gtk::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();