diff --git a/.env_debug b/.env_debug new file mode 100644 index 0000000..135fe79 --- /dev/null +++ b/.env_debug @@ -0,0 +1,4 @@ +# RUN="sudo" +# PARAM="/usr/bin/pacman -Syu --needed --noconfirm" +RUN="find" +PARAM=".git" diff --git a/Cargo.toml b/Cargo.toml index 2c0a0ca..426cdf1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" [dependencies] futures = "^0.3" fltk = { version = "^1.4", features = ["fltk-bundled"] } -# fltk-theme = "^0.7" -tokio = { version = "1.28.1", features = ["full"] } +fltk-theme = "^0.7" +tokio = { version = "^1.33", features = ["full"] } # bytes = "^1.4" dotenv = "^0.15" diff --git a/assets/icons/Melawy.png b/assets/icons/Melawy.png new file mode 100644 index 0000000..4c84186 Binary files /dev/null and b/assets/icons/Melawy.png differ diff --git a/assets/icons/Melawy.svg b/assets/icons/Melawy.svg new file mode 100644 index 0000000..309d477 --- /dev/null +++ b/assets/icons/Melawy.svg @@ -0,0 +1,53 @@ + + + + + + + + + + diff --git a/src/main.rs b/src/main.rs index 30b877c..26b1ee2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,8 @@ extern crate dotenv; -use fltk::{prelude::*, app, text::SimpleTerminal, frame::Frame, window::Window}; +use fltk::{prelude::*, app, text::SimpleTerminal, enums::Color, frame, window, /*button,*/ image}; +use fltk_theme::{/*ColorTheme, color_themes, widget_themes, */WidgetTheme, ThemeType, /*WidgetScheme, SchemeType*/}; use tokio::io::{self, BufReader, AsyncBufReadExt}; use tokio::process::Command; @@ -14,6 +15,7 @@ use std::path::Path; async fn run_process() -> tokio::process::Child { let env_path = Path::new("/etc/arch-linux-updater/.env"); + // let env_path = Path::new(".env_debug"); dotenv::from_path(env_path).unwrap(); @@ -73,18 +75,29 @@ async fn gui() -> io::Result<()> { let height = 700; let app = app::App::default(); - let mut wind: fltk::window::DoubleWindow = Window::default() + // let app = app::App::default().with_scheme(app::Scheme::Gtk); // Base, Gleam, Gtk, Oxy, Plastic + + let widget_theme = WidgetTheme::new(ThemeType::Dark); + widget_theme.apply(); + + let mut wind: fltk::window::DoubleWindow = window::Window::default() .with_size(width, height) .center_screen() .with_label("Arch Linux Updater"); - let frame = Frame::default_fill() + let image = image::PngImage::load("assets/icons/Melawy.png").unwrap(); + // let image = image::PngImage::load(&std::path::Path::new("assets/icons/Melawy.png")).unwrap(); + wind.set_icon(Some(image)); + + let frame = frame::Frame::default_fill() .with_size(width, height) .center_of(&wind); let mut terminal: SimpleTerminal = SimpleTerminal::default_fill() .with_size(width, height) .center_of(&frame); + terminal.set_color(Color::Background2); + terminal.set_text_color(Color::Light2); wind.make_resizable(true); wind.end(); @@ -94,6 +107,8 @@ async fn gui() -> io::Result<()> { let mut lines: io::Lines> = get_lines().await; + + // app.run().unwrap(); while app.wait() { if let Some(line) = get_line(&mut lines).await? { terminal.append(format!("{}\n", line).as_str());