diff --git a/locales/app.yml b/locales/app.yml index bcbf71d..4f23d1c 100644 --- a/locales/app.yml +++ b/locales/app.yml @@ -110,14 +110,26 @@ button.restart_tuned_and_ppd: en: Restart Tuned and Power Profile Daemon ru_RU.UTF-8: Перезапустить Tuned и Power Profile Daemon +button.status_tuned_and_ppd: + en: Status Tuned and Power Profile Daemon + ru_RU.UTF-8: Статус Tuned и Power Profile Daemon + button.restart_dns_crypt_proxy: en: Restart DNS Crypt Proxy ru_RU.UTF-8: Перезапустить DNS Crypt Proxy +button.status_dns_crypt_proxy: + en: Status DNS Crypt Proxy + ru_RU.UTF-8: Статус DNS Crypt Proxy + button.restart_tor: en: Restart Tor ru_RU.UTF-8: Перезапустить Tor +button.status_tor: + en: Status Tor + ru_RU.UTF-8: Статус Tor + button.visit_stie_melawy_linux: en: Visit Melawy Linux site ru_RU.UTF-8: Посетить сайт Melawy Linux diff --git a/scripts/run_installer_with_partition_separated_layout.sh b/scripts/run_installer_with_partition_separated_layout.sh index 9763237..eab2682 100755 --- a/scripts/run_installer_with_partition_separated_layout.sh +++ b/scripts/run_installer_with_partition_separated_layout.sh @@ -1,4 +1,4 @@ #!/bin/bash cp -vf /etc/calamares/modules/partition_separated.conf /etc/calamares/modules/partition.conf -dbus-launch calamares +dbus-launch calamares -D8 diff --git a/scripts/run_installer_with_partition_shared_layout.sh b/scripts/run_installer_with_partition_shared_layout.sh index d1e1abb..f410992 100755 --- a/scripts/run_installer_with_partition_shared_layout.sh +++ b/scripts/run_installer_with_partition_shared_layout.sh @@ -1,4 +1,4 @@ #!/bin/bash cp -vf /etc/calamares/modules/partition_shared.conf /etc/calamares/modules/partition.conf -dbus-launch calamares +dbus-launch calamares -D8 diff --git a/src/main.rs b/src/main.rs index e75eed6..8e2a260 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,7 @@ i18n!("locales", fallback = "en"); use fltk::{ app::App, + app::Screen, button::*, enums::*, frame::Frame, @@ -81,8 +82,30 @@ fn main() { let current_date = chrono::Utc::now(); let current_year = format!("{}", current_date.year()); - let width = 800; - let height = 700; + let padding: i32 = 10; + + 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 application = App::default(); @@ -128,8 +151,8 @@ fn main() { && Path::new("/etc/calamares/modules/").exists() { let mut col_install_new_sys = Flex::default().column(); - col_install_new_sys.set_margin(10); - col_install_new_sys.set_pad(10); + col_install_new_sys.set_margin(padding); + col_install_new_sys.set_pad(padding); let _installation_start_here = Frame::default().with_label(&t!("label.installation_start_here")); @@ -218,8 +241,10 @@ fn main() { .with_label(&t!("tab.sys_and_rep")) .row(); let mut col_sys_and_repo = Flex::default().column(); - col_sys_and_repo.set_margin(10); - col_sys_and_repo.set_pad(10); + col_sys_and_repo.set_margin(padding); + col_sys_and_repo.set_pad(padding); + + let row_repo = Flex::default().row(); let mut btn_update_repo_mirrorlists = Button::default().with_label(&t!("button.update_repo_mirrorlists")); @@ -254,6 +279,8 @@ fn main() { }); }); + row_repo.end(); + let mut btn_update_system = Button::default().with_label(&t!("button.update_system")); btn_update_system.set_callback(move |b| { @@ -269,6 +296,8 @@ fn main() { }); }); + let row_update_alter = Flex::default().row(); + let mut btn_update_system_alter = Button::default().with_label(&t!("button.update_system_alter")); @@ -303,6 +332,8 @@ fn main() { }); }); + row_update_alter.end(); + let mut btn_unlock_repo_databases = Button::default().with_label(&t!("button.unlock_repo_databases")); @@ -320,6 +351,8 @@ fn main() { }); }); + let row_clear_package_cache = Flex::default().row(); + let mut btn_clear_old_package_cache = Button::default().with_label(&t!("button.сlear_old_package_cache")); @@ -352,6 +385,10 @@ fn main() { }); }); + row_clear_package_cache.end(); + + let row_reinstall_package = Flex::default().row(); + let mut btn_check_missing_files_in_packages = Button::default().with_label(&t!("button.fix_missing_files_in_packages")); @@ -386,6 +423,8 @@ fn main() { }); }); + row_reinstall_package.end(); + col_sys_and_repo.end(); grp_sys_and_repo.end(); @@ -393,8 +432,10 @@ fn main() { let grp_services = Flex::default_fill().with_label(&t!("tab.services")).row(); let mut col_services = Flex::default().column(); - col_services.set_margin(10); - col_services.set_pad(10); + col_services.set_margin(padding); + col_services.set_pad(padding); + + let row_kde = Flex::default().row(); let mut btn_restart_kde_plasma = Button::default().with_label(&t!("button.restart_kde_plasma")); @@ -456,6 +497,10 @@ fn main() { }); }); + row_kde.end(); + + let row_tuned = Flex::default().row(); + let mut btn_restart_tuned = Button::default().with_label(&t!("button.restart_tuned_and_ppd")); btn_restart_tuned.set_callback(move |b| { @@ -471,6 +516,25 @@ fn main() { }); }); + let mut btn_status_tuned = Button::default().with_label(&t!("button.status_tuned_and_ppd")); + + btn_status_tuned.set_callback(move |b| { + b.deactivate(); + std::thread::spawn({ + let mut b = b.clone(); + move || { + let cmd = "/usr/bin/konsole --noclose --separate -e systemctl status tuned.service tuned-ppd.service"; + let _ = run_cmd(cmd, None); + + b.activate(); + } + }); + }); + + row_tuned.end(); + + let row_dns_crypt_proxy = Flex::default().row(); + let mut btn_restart_dnscrypt_proxy = Button::default().with_label(&t!("button.restart_dns_crypt_proxy")); @@ -487,6 +551,26 @@ fn main() { }); }); + let mut btn_status_dnscrypt_proxy = + Button::default().with_label(&t!("button.status_dns_crypt_proxy")); + + btn_status_dnscrypt_proxy.set_callback(move |b| { + b.deactivate(); + std::thread::spawn({ + let mut b = b.clone(); + move || { + let cmd = "/usr/bin/konsole --noclose --separate -e systemctl status dnscrypt-proxy.service"; + let _ = run_cmd(cmd, None); + + b.activate(); + } + }); + }); + + row_dns_crypt_proxy.end(); + + let row_tor = Flex::default().row(); + let mut btn_restart_tor = Button::default().with_label(&t!("button.restart_tor")); btn_restart_tor.set_callback(move |b| { @@ -502,6 +586,23 @@ fn main() { }); }); + let mut btn_status_tor = Button::default().with_label(&t!("button.status_tor")); + + btn_status_tor.set_callback(move |b| { + b.deactivate(); + std::thread::spawn({ + let mut b = b.clone(); + move || { + let cmd = "/usr/bin/konsole --noclose --separate -e systemctl status tor.service"; + let _ = run_cmd(cmd, None); + + b.activate(); + } + }); + }); + + row_tor.end(); + col_services.end(); grp_services.end(); @@ -511,8 +612,8 @@ fn main() { .with_label(&t!("tab.information")) .row(); let mut col_information = Flex::default().column(); - col_information.set_margin(10); - col_information.set_pad(10); + col_information.set_margin(padding); + col_information.set_pad(padding); let mut btn_visit_site = Button::default().with_label(&t!("button.visit_stie_melawy_linux")); @@ -666,9 +767,9 @@ fn main() { // ----------------------------------------------------------- - let mut grp_about = Flex::default_fill().with_label(&t!("tab.about")).column(); - // grp_about.set_margin(10); - grp_about.set_pad(10); + let mut grp_about = Flex::default_fill().with_label(&t!("tab.about")).row(); + // grp_about.set_margin(padding); + grp_about.set_pad(padding); if locale == "ru_RU.UTF-8" { let mut term = terminal::Terminal::default_fill();