Update
This commit is contained in:
parent
074f892f28
commit
d6fca2592e
47
src/main.rs
47
src/main.rs
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
extern crate dotenv;
|
extern crate dotenv;
|
||||||
|
|
||||||
use fltk::{app, enums::Color, frame, /*button,*/ image, prelude::*, terminal::Terminal, window,};
|
use fltk::{
|
||||||
|
app, app::Screen, enums::Color, frame, /*button,*/ image, prelude::*, terminal::Terminal,
|
||||||
|
window,
|
||||||
|
};
|
||||||
use fltk_theme::{
|
use fltk_theme::{
|
||||||
SchemeType, ThemeType, WidgetScheme,
|
SchemeType, ThemeType, WidgetScheme,
|
||||||
/*ColorTheme, color_themes, widget_themes, */ WidgetTheme,
|
/*ColorTheme, color_themes, widget_themes, */ WidgetTheme,
|
||||||
|
@ -75,8 +78,30 @@ async fn get_line(
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn gui() -> io::Result<()> {
|
async fn gui() -> io::Result<()> {
|
||||||
let width = 1100;
|
// let padding: i32 = 10;
|
||||||
let height = 700;
|
|
||||||
|
let title_and_panel_h: i32 = 68;
|
||||||
|
|
||||||
|
// let (w, h) = app::screen_size();
|
||||||
|
// println!("{} {}", w, h);
|
||||||
|
|
||||||
|
// let width = 1280;
|
||||||
|
// let height = 720;
|
||||||
|
|
||||||
|
let screens = Screen::all_screens();
|
||||||
|
|
||||||
|
let mut width = 100000;
|
||||||
|
let mut height = 100000;
|
||||||
|
for s in screens {
|
||||||
|
if s.work_area().w < width {
|
||||||
|
width = s.work_area().w;
|
||||||
|
}
|
||||||
|
if s.work_area().h < height {
|
||||||
|
height = s.work_area().h;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
height = height - title_and_panel_h;
|
||||||
|
|
||||||
let app = app::App::default();
|
let app = app::App::default();
|
||||||
// let app = app::App::default().with_scheme(app::Scheme::Gtk); // Base, Gleam, Gtk, Oxy, Plastic
|
// let app = app::App::default().with_scheme(app::Scheme::Gtk); // Base, Gleam, Gtk, Oxy, Plastic
|
||||||
|
@ -87,29 +112,29 @@ async fn gui() -> io::Result<()> {
|
||||||
let widget_scheme = WidgetScheme::new(SchemeType::Fluent);
|
let widget_scheme = WidgetScheme::new(SchemeType::Fluent);
|
||||||
widget_scheme.apply();
|
widget_scheme.apply();
|
||||||
|
|
||||||
let mut wind: fltk::window::DoubleWindow = window::Window::default()
|
let mut win: fltk::window::DoubleWindow = window::Window::default()
|
||||||
.with_size(width, height)
|
.with_size(width, height)
|
||||||
.center_screen()
|
.center_screen()
|
||||||
.with_label("Melawy Linux Updater");
|
.with_label("Melawy Linux Updater");
|
||||||
|
|
||||||
let image =
|
let image =
|
||||||
image::SvgImage::load("/usr/share/melawy-linux-updater/assets/icons/Melawy.svg").unwrap();
|
image::SvgImage::load("/usr/share/melawy-linux-updater/assets/icons/Melawy.svg").unwrap();
|
||||||
wind.set_icon(Some(image));
|
win.set_icon(Some(image));
|
||||||
|
|
||||||
let frame = frame::Frame::default_fill()
|
let frame = frame::Frame::default_fill()
|
||||||
.with_size(width, height)
|
.with_size(win.width(), win.height())
|
||||||
.center_of(&wind);
|
.center_of(&win);
|
||||||
|
|
||||||
let mut term: Terminal = Terminal::default_fill()
|
let mut term: Terminal = Terminal::default_fill()
|
||||||
.with_size(width, height)
|
.with_size(win.width(), win.height())
|
||||||
.center_of(&frame);
|
.center_of(&frame);
|
||||||
term.set_color(Color::Background2);
|
term.set_color(Color::Background2);
|
||||||
term.set_text_color(Color::Light2);
|
term.set_text_color(Color::Light2);
|
||||||
term.set_history_rows(5000);
|
term.set_history_rows(5000);
|
||||||
|
|
||||||
wind.make_resizable(true);
|
win.make_resizable(true);
|
||||||
wind.end();
|
win.end();
|
||||||
wind.show();
|
win.show();
|
||||||
|
|
||||||
let mut printed_close_msg = false;
|
let mut printed_close_msg = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue