Skip to content
4 changes: 4 additions & 0 deletions i18n/en/cachyos_hello.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 24 additions & 2 deletions i18n/tr/cachyos_hello.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Comment thread
MorphyKutay marked this conversation as resolved.
# 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ş
Expand All @@ -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ç
Expand All @@ -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.
Expand All @@ -58,14 +77,17 @@ 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
Comment thread
MorphyKutay marked this conversation as resolved.
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
Expand Down
25 changes: 20 additions & 5 deletions src/pages/i18n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@ use crate::fl;
use gtk::prelude::*;

use gtk::Builder;
use tracing::warn;

fn update_translation_apps_section(section_box: &gtk::Box) {
for section_box_element in section_box.children() {
if let Ok(section_label) = section_box_element.clone().downcast::<gtk::Label>() {
section_label.set_text(&fl!("applications"));
} else if let Ok(hbox) = section_box_element.downcast::<gtk::Box>() {
for child in hbox.children() {
if let Ok(btn) = child.downcast::<gtk::Button>() {
let id = btn.widget_name();
if id.is_empty() {
continue;
}
let translated = crate::localization::get_locale_text(&id);
btn.set_label(&translated);
}
}
}
}
}
Expand All @@ -16,10 +28,11 @@ fn update_translation_fixes_section(section_box: &gtk::Box) {
for section_box_element in section_box.children() {
if let Ok(button_box) = section_box_element.clone().downcast::<gtk::Box>() {
for button_box_widget in button_box.children() {
let box_element_btn = button_box_widget.downcast::<gtk::Button>().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::<gtk::Button>() {
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::<gtk::Label>() {
section_label.set_text(&fl!("fixes"));
Expand Down Expand Up @@ -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");
},
}
Comment thread
MorphyKutay marked this conversation as resolved.
}
}
Expand Down
76 changes: 36 additions & 40 deletions src/pages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
});
});
Expand All @@ -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<gtk::Box> {
let topbox = gtk::Box::new(gtk::Orientation::Vertical, 2);
let box_collection = gtk::Box::new(gtk::Orientation::Horizontal, 10);
Expand All @@ -195,17 +207,28 @@ fn create_apps_section() -> Option<gtk::Box> {
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);
Expand Down Expand Up @@ -313,30 +336,3 @@ fn on_clear_pkgcache_btn_clicked(_: &gtk::Button) {
actions::clear_pkgcache(crate::gui::run_command);
});
}

fn on_appbtn_clicked(button: &gtk::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());
});
}
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down