From d629d414fd8211e67ec3a5f918b6eb00826d6671 Mon Sep 17 00:00:00 2001 From: KeksNino Date: Tue, 5 Aug 2025 16:55:06 +0200 Subject: [PATCH] Revert "added kill button, now actually usable" This reverts commit e377b0308d3c081cedda1245cc2481df789563ff. --- src/main.rs | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/main.rs b/src/main.rs index 518dd15..a8dfc81 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,20 +54,9 @@ fn build_ui(app: &Application) { wrapper_box.set_hexpand(true); wrapper_box.set_vexpand(true); - // Kill Process Button - let button2 = Button::with_label("Kill Wallpaper Engine Process"); - // FILE CHOOSER BUTTON let button = Button::with_label("Select Workshop Folder"); wrapper_box.append(&button); - wrapper_box.append(&button2); - - button2.connect_clicked(|_| { - let killcommand = Command::new("/usr/bin/pkill") - .arg("-9") - .arg("linux-wallpaper") - .spawn(); - }); // SCROLLED WINDOW FOR IMAGES let scrolled_window = ScrolledWindow::builder() @@ -157,9 +146,7 @@ fn load_images( .filter_map(Result::ok) { let path = entry.path().to_path_buf(); - if path.file_name().is_some_and(|name| { - name == "preview.jpg" || name == "preview.gif" || name == "preview.png" - }) { + if path.file_name().is_some_and(|name| name == "preview.jpg") { let image = Image::from_file(&path); image.set_pixel_size(150); @@ -168,17 +155,13 @@ fn load_images( let app_state_clone = app_state.clone(); button.connect_clicked(move |_| { - let command_path = path_clone - .to_string_lossy() - .replace("/preview.jpg", "") - .replace("/preview.gif", "") - .replace("/preview.png", ""); + let command_path = path_clone.to_string_lossy().replace("/preview.jpg", ""); let mut state = app_state_clone.lock().unwrap(); if let Some(mut child) = state.current_process.take() { println!("Terminating previous wallpaper process"); let _ = child.kill(); } - let command = Command::new("linux-wallpaperengine") + let child = Command::new("linux-wallpaperengine") .arg("--use-angle=GL") .arg("--screen-root=DP-2") .arg("--screen-root=DP-1") @@ -186,7 +169,8 @@ fn load_images( .arg("--silent") .arg(&command_path) .spawn(); - match command { + //let status = child.wait().expect("Failed to wait on child process"); + match child { Ok(child_process) => { println!("Started wallpaper engine with: {}", command_path); state.current_process = Some(child_process);