diff --git a/i18n/en/cachyos_hello.ftl b/i18n/en/cachyos_hello.ftl index d6ae6f69..a929ef11 100644 --- a/i18n/en/cachyos_hello.ftl +++ b/i18n/en/cachyos_hello.ftl @@ -14,6 +14,10 @@ gaming-package-installed = Gaming packages already installed! winboat-package-installed = Winboat packages already installed! vram-management-package-installed = VRAM management packages already installed! +# Tweaks page — quick launch (CachyOS apps) +app-cachyos-pi-label = CachyOS Package Installer +app-cachyos-kernel-manager-label = CachyOS Kernel Manager + # Application Browser page advanced-btn = advanced reset-btn = reset diff --git a/i18n/tr/cachyos_hello.ftl b/i18n/tr/cachyos_hello.ftl index d1612174..ed6c3fe1 100644 --- a/i18n/tr/cachyos_hello.ftl +++ b/i18n/tr/cachyos_hello.ftl @@ -11,6 +11,12 @@ lock-doesnt-exist = Pacman veritabanı kilidi bulunmamaktadır! orphans-not-found = Hiçbir artık (orphan) paket bulunamadı! package-not-installed = '{$package_name}' paketi kurulmamıştır! gaming-package-installed = Oyun paketleri halihazırda kurulu! +winboat-package-installed = Winboat paketleri zaten kurulu! +vram-management-package-installed = VRAM yönetim paketleri zaten kurulu! + +# Tweaks page — quick launch (CachyOS apps) +app-cachyos-pi-label = CachyOS Paket Kurucu +app-cachyos-kernel-manager-label = CachyOS Çekirdek Yöneticisi # Application Browser page advanced-btn = gelişmiş @@ -31,6 +37,9 @@ apply = Uygula reset = Sıfırla enable-dot = DNS over TLS (DoT) etkinleştir dot-tooltip = Daha iyi gizlilik için DNS sorgularını TLS ile şifrele (sunucu desteği gerektirir) +enable-doh = HTTPS üzerinden DNS (DoH) etkinleştir +doh-tooltip = Daha iyi gizlilik için DNS sorgularını yerel blocky vekil sunucusu üzerinden HTTPS ile şifrele (sunucu desteği gerektirir; blocky kurar) +doh-blocky-install-failed = DoH desteği için blocky kurulamadı! test-latency = Seçili Sunucunun Gecikmesini Test Et test-latency-tooltip = Seçili DNS sunucusuna ağ gecikmesini ölç best-server = Gecikmeye Göre En İyi Sunucuyu Seç @@ -40,11 +49,21 @@ server-info = {""} latency-testing = test ediliyor... latency-timeout = zaman aşımı latency-no-result = hiçbir sunucu yanıt vermedi -dns-check-hint = Uyguladıktan sonra DNS sağlayıcınızı doğrulayın +custom-dns = Özel +dhcp-automatic = DHCP (otomatik) +custom-dns-ipv4 = IPv4 adresleri (virgülle ayrılmış): +custom-dns-ipv6 = IPv6 adresleri (virgülle ayrılmış): +custom-dns-dot-hostname = DoT ana bilgisayar adı (isteğe bağlı): +custom-dns-invalid = Lütfen en az bir IPv4 veya IPv6 adresi girin +custom-dns-invalid-hostname = Geçersiz DoT ana bilgisayar adı +custom-dns-doh-url = DoH URL’si (HTTPS üzerinden DNS için): +custom-dns-doh-url-required = Lütfen https:// ile başlayan geçerli bir DoH URL’si girin +dns-check-hint = Uyguladıktan sonra DNS sağlayıcınızı şu adreste doğrulayın: dns-server-changed = DNS sunucusu başarıyla değiştirildi! dns-server-failed = DNS sunucusu değiştirme işlemi başarısız oldu! dns-server-reset = DNS sunucusu eski haline getirildi! dns-server-reset-failed = DNS sunucusu sıfırlama işlemi başarısız oldu! +winboat-install-failed = Winboat kurulamadı! # Tweaks page (tweaks) tweak-enabled-title = {$tweak} etkinleştirildi. @@ -58,7 +77,7 @@ tweak-cachyupdate-tooltip = Güncelleme bildirim servisi # Tweaks page (fixes) remove-lock-title = Pacman veritabanı kilidini kaldır reinstall-title = Tüm paketleri yeniden kur -reset-keyrings-title = Reset keyrings +reset-keyrings-title = Anahtar halkalarını sıfırla update-system-title = Sistem güncellemesi remove-orphans-title = Artık (orphan) paketleri kaldır clear-pkgcache-title = Önbellekteki paketleri temizle @@ -66,6 +85,9 @@ rankmirrors-title = Yansıları hıza göre sırala dnsserver-title = DNS sunucusunu değiştir show-kwinw-debug-title = KWin (Wayland) hata ayıklama penceresini göster install-gaming-title = Oyun paketlerini kur +install-winboat-title = Winboat kur +install-vram-management-title = VRAM yönetimini kur +install-vram-management-tooltip = AMD veya Intel GPU’larda dmemcg-booster ve plasma-foreground-booster paketlerini kur # Main Page (buttons) button-about-tooltip = Hakkında diff --git a/src/pages/i18n.rs b/src/pages/i18n.rs index 17ef8c2b..1e98a123 100644 --- a/src/pages/i18n.rs +++ b/src/pages/i18n.rs @@ -3,11 +3,23 @@ use crate::fl; use gtk::prelude::*; use gtk::Builder; +use tracing::warn; fn update_translation_apps_section(section_box: >k::Box) { for section_box_element in section_box.children() { if let Ok(section_label) = section_box_element.clone().downcast::() { section_label.set_text(&fl!("applications")); + } else if let Ok(hbox) = section_box_element.downcast::() { + for child in hbox.children() { + if let Ok(btn) = child.downcast::() { + let id = btn.widget_name(); + if id.is_empty() { + continue; + } + let translated = crate::localization::get_locale_text(&id); + btn.set_label(&translated); + } + } } } } @@ -16,10 +28,11 @@ fn update_translation_fixes_section(section_box: >k::Box) { for section_box_element in section_box.children() { if let Ok(button_box) = section_box_element.clone().downcast::() { for button_box_widget in button_box.children() { - let box_element_btn = button_box_widget.downcast::().unwrap(); - let widget_name = box_element_btn.widget_name(); - let translated_text = crate::localization::get_locale_text(&widget_name); - box_element_btn.set_label(&translated_text); + if let Ok(box_element_btn) = button_box_widget.downcast::() { + let widget_name = box_element_btn.widget_name(); + let translated_text = crate::localization::get_locale_text(&widget_name); + box_element_btn.set_label(&translated_text); + } } } else if let Ok(section_label) = section_box_element.downcast::() { section_label.set_text(&fl!("fixes")); @@ -107,7 +120,9 @@ pub fn update_translations(builder: &Builder) { "tweaksBrowserpage_apps" => { update_translation_apps_section(&second_child_child_box); }, - _ => panic!("Unknown widget!"), + name => { + warn!(widget_name = %name, "unexpected section box in tweaks page; translations may be incomplete"); + }, } } } diff --git a/src/pages/mod.rs b/src/pages/mod.rs index 8f7c020f..4452ce85 100644 --- a/src/pages/mod.rs +++ b/src/pages/mod.rs @@ -6,10 +6,11 @@ use crate::ui::{Action, UI}; use crate::{actions, fl, systemd_units, utils}; use std::path::Path; -use std::str; use gtk::prelude::*; +use gtk::{glib, Builder}; +use tracing::{debug, warn}; use gtk::{Builder, glib}; use tracing::debug; use which::which; @@ -174,9 +175,7 @@ fn create_fixes_section(builder: &Builder) -> gtk::Box { if utils::is_kwin_wayland() { let kwinw_debug_btn = create_gtk_button!("show-kwinw-debug-title"); kwinw_debug_btn.connect_clicked(move |_| { - // Spawn child process in separate thread. std::thread::spawn(move || { - // do we even need to start that in separate thread. should be fine without actions::launch_kwin_debug_window(); }); }); @@ -187,6 +186,19 @@ fn create_fixes_section(builder: &Builder) -> gtk::Box { topbox } +fn spawn_cachyos_app(exec_path: String) { + std::thread::spawn(move || { + match utils::spawn_detached(&exec_path) { + Ok(exit_status) => { + debug!("Exit status successfully? = {:?}", exit_status.success()); + } + Err(e) => { + warn!(?e, path = %exec_path, "Failed to spawn CachyOS app"); + } + } + }); +} + fn create_apps_section() -> Option { let topbox = gtk::Box::new(gtk::Orientation::Vertical, 2); let box_collection = gtk::Box::new(gtk::Orientation::Horizontal, 10); @@ -195,17 +207,28 @@ fn create_apps_section() -> Option { label.set_justify(gtk::Justification::Center); label.set_text(&fl!("applications")); - // Check first btn. - if Path::new("/sbin/cachyos-pi").exists() { - let cachyos_pi = gtk::Button::with_label("CachyOS PackageInstaller"); - cachyos_pi.connect_clicked(on_appbtn_clicked); - box_collection.pack_start(&cachyos_pi, true, true, 2); + // Show buttons only when the executable is on PATH (same resolution as spawn). + if let Ok(path) = which("cachyos-pi") { + match path.to_str() { + Some(path_str) => { + let exec_path = path_str.to_owned(); + let cachyos_pi = create_gtk_button!("app-cachyos-pi-label"); + cachyos_pi.connect_clicked(move |_| spawn_cachyos_app(exec_path.clone())); + box_collection.pack_start(&cachyos_pi, true, true, 2); + }, + None => warn!(path = ?path, "cachyos-pi path is not valid UTF-8; skipping button"), + } } - // Check second btn. - if Path::new("/sbin/cachyos-kernel-manager").exists() { - let cachyos_km = gtk::Button::with_label("CachyOS Kernel Manager"); - cachyos_km.connect_clicked(on_appbtn_clicked); - box_collection.pack_start(&cachyos_km, true, true, 2); + if let Ok(path) = which("cachyos-kernel-manager") { + match path.to_str() { + Some(path_str) => { + let exec_path = path_str.to_owned(); + let cachyos_km = create_gtk_button!("app-cachyos-kernel-manager-label"); + cachyos_km.connect_clicked(move |_| spawn_cachyos_app(exec_path.clone())); + box_collection.pack_start(&cachyos_km, true, true, 2); + }, + None => warn!(path = ?path, "cachyos-kernel-manager path is not valid UTF-8; skipping button"), + } } topbox.pack_start(&label, true, true, 5); @@ -313,30 +336,3 @@ fn on_clear_pkgcache_btn_clicked(_: >k::Button) { actions::clear_pkgcache(crate::gui::run_command); }); } - -fn on_appbtn_clicked(button: >k::Button) { - // Get button label. - let name = button.label().unwrap(); - let binname = if name == "CachyOS PackageInstaller" { - "cachyos-pi" - } else if name == "CachyOS Kernel Manager" { - "cachyos-kernel-manager" - } else { - "" - }; - - // Get executable path, overwise return if it doesn't exist. - let exec_path = which(binname); - if exec_path.is_err() { - return; - } - - // Spawn child process in separate thread. - std::thread::spawn(move || { - // Get executable path. - let exec_path = exec_path.unwrap().to_str().unwrap().to_owned(); - let exit_status = utils::spawn_detached(&exec_path).expect("Failed to spawn process"); - - debug!("Exit status successfully? = {:?}", exit_status.success()); - }); -} diff --git a/src/utils.rs b/src/utils.rs index bf28cde9..b2ff53a8 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -178,7 +178,7 @@ pub fn has_intel_or_amd_gpu() -> bool { data_obj.pci_devices.iter().any(|device| is_intel_amd_gpu(&device.vendor_id, &device.class_id)) } -/// Returns true if the kwin is currently running. +/// Returns true if KWin is running under a Wayland session. pub fn is_kwin_wayland() -> bool { Exec::cmd("pgrep") .args(&["kwin_wayland"])