diff --git a/data/dialog-error.sh b/data/dialog-error.sh new file mode 100755 index 0000000..d679172 --- /dev/null +++ b/data/dialog-error.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +zenity --error --text "There was a problem installing the following driver: "$1"" diff --git a/data/dialog-success.sh b/data/dialog-success.sh new file mode 100755 index 0000000..2abb9c1 --- /dev/null +++ b/data/dialog-success.sh @@ -0,0 +1,6 @@ +#! /bin/bash + +if zenity --question --text ""$1" has been processed successfully. Would you like to reboot for changes to take effect?" +then + systemctl reboot +fi diff --git a/src/main.rs b/src/main.rs index e0024b8..a9e39a5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,6 @@ use gtk::prelude::*; use gtk::*; use glib::*; use gdk::Display; -use std::sync::mpsc::channel; const PROJECT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -202,6 +201,13 @@ fn modify_package(package: &str, driver_button: &Image) { println!("Installation was successful!\n"); println!("Refreshing GUI Labels.\n"); driver_button_refresh(package, driver_button); + let _success_command = Command::new("bash") + .arg("-c") + .arg("/usr/lib/pika/drivers/dialog-success.sh \"$1\"") + .arg("bash") // $0 + .arg(&str_pkg) // $1 + .spawn() + .unwrap(); } else { println!("Installation Command has ended.\n"); println!("Installation was failed :(\n"); @@ -213,7 +219,7 @@ fn modify_package(package: &str, driver_button: &Image) { .arg("/usr/lib/pika/drivers/dialog-error.sh \"$1\"") .arg("bash") // $0 .arg(&str_pkg) // $1 - .output() + .spawn() .unwrap(); } } @@ -292,6 +298,7 @@ fn get_drivers(main_window: &ApplicationWindow, ubuntu_drivers_list_utf8: String .build(); let driver_label = gtk::Label::builder() + .vexpand(true) .margin_top(12) .build(); driver_label.add_css_class("startLabel"); @@ -376,11 +383,10 @@ fn get_drivers(main_window: &ApplicationWindow, ubuntu_drivers_list_utf8: String .build(); let driver_middle_part_description_label = gtk::Label::builder() - .margin_top(12) - .margin_bottom(12) .margin_start(12) .margin_end(12) .hexpand(true) + .vexpand(true) .halign(Align::Start) .justify(Justification::Left) .build();