Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions i18n/en/cachyos_hello.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ install-gaming-title = Install Gaming packages
install-winboat-title = Install Winboat
install-vram-management-title = Install VRAM Management
install-vram-management-tooltip = Prioritize VRAM for the foreground application so the GPU driver avoids spilling buffers into system RAM (GTT).
fix-tsc-warp-title = Fix slow system clock (TSC)
fix-tsc-warp-tooltip = This boot's log shows cores starting out of sync, so Linux fell back to the much slower HPET clock. Opens a terminal that adds tsc=directsync to the kernel command line and regenerates your bootloader config; review the commands before they run. Takes effect after a reboot — if the clock is still on hpet afterwards, update your linux-cachyos package and try again.
revert-tsc-warp-title = Undo system clock fix (TSC)
revert-tsc-warp-tooltip = Opens a terminal that removes tsc=directsync from the kernel command line and regenerates your bootloader config. Takes effect after a reboot.

# Main Page (buttons)
button-about-tooltip = About
Expand Down
4 changes: 4 additions & 0 deletions i18n/ru/cachyos_hello.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ install-gaming-title = Установить пакеты для игр
install-winboat-title = Установить Winboat
install-vram-management-title = Установить пакеты управления VRAM
install-vram-management-tooltip = Приоритизировать VRAM для активного приложения, чтобы драйвер GPU не переносил буферы в системную ОЗУ (GTT).
fix-tsc-warp-title = Исправить медленные системные часы (TSC)
fix-tsc-warp-tooltip = В журнале этой загрузки видно, что ядра процессора стартовали с рассинхронизированными счётчиками, поэтому Linux переключился на гораздо более медленные часы HPET. Откроется терминал, который добавит tsc=directsync в параметры ядра и пересоберёт конфигурацию загрузчика; проверьте команды перед запуском. Вступит в силу после перезагрузки — если часы всё ещё hpet, обновите пакет linux-cachyos и попробуйте снова.
revert-tsc-warp-title = Отменить исправление системных часов (TSC)
revert-tsc-warp-tooltip = Откроется терминал, который удалит tsc=directsync из параметров ядра и пересоберёт конфигурацию загрузчика. Вступит в силу после перезагрузки.


# Main Page (buttons)
Expand Down
25 changes: 23 additions & 2 deletions src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ use crate::networkmanager::{self, DnsMods, NmDnsOverTls};
use crate::systemd_units::Scope;
use crate::tweak::{self, TweakName};
use crate::ui::{Action, DialogMessage, MessageType, RunCmdCallback};
use crate::{PacmanWrapper, dns, fl, kwin_dbus, systemd_units, utils};
use crate::{PacmanWrapper, dns, fl, kwin_dbus, systemd_units, tsc_fix, utils};

use std::path::Path;
use std::time::Duration;
use std::{env, io, thread};

use async_channel::Sender;
use tracing::error;
use tracing::{debug, error};

fn split_dns_addrs(addrs: &str) -> Vec<String> {
addrs.split(',').filter(|s| !s.is_empty()).map(String::from).collect()
Expand Down Expand Up @@ -137,6 +137,27 @@ pub fn launch_kwin_debug_window() {
}
}

/// Adds `tsc=directsync` to the kernel command line, in a visible terminal
/// since it edits the boot configuration.
pub fn apply_tsc_directsync(callback: RunCmdCallback) -> bool {
let Some(bootloader) = tsc_fix::detect_bootloader() else {
error!("apply_tsc_directsync called with no supported bootloader detected");
return false;
};
debug!("Applying tsc=directsync via {}", bootloader.name());
utils::run_cmd_terminal(callback, tsc_fix::apply_commands(bootloader), true)
}

/// Undoes [`apply_tsc_directsync`].
pub fn revert_tsc_directsync(callback: RunCmdCallback) -> bool {
let Some(bootloader) = tsc_fix::detect_bootloader() else {
error!("revert_tsc_directsync called with no supported bootloader detected");
return false;
};
debug!("Reverting tsc=directsync via {}", bootloader.name());
utils::run_cmd_terminal(callback, tsc_fix::revert_commands(bootloader), true)
}

pub fn change_dns_server(
conn_name: &str,
server_addr_ipv4: &str,
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod logger;
mod networkmanager;
mod pages;
mod systemd_units;
mod tsc_fix;
mod tweak;
mod ui;
mod utils;
Expand Down
11 changes: 11 additions & 0 deletions src/pages/i18n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ fn update_translation_button_section(
let box_element_btn = button_box_widget.downcast::<gtk::Button>().unwrap();
let widget_name = box_element_btn.widget_name();
box_element_btn.set_label(&button_label(&widget_name));
// "<id>-title" buttons with a tooltip have it under "<id>-tooltip".
if box_element_btn.tooltip_text().is_some()
&& let Some(id) = widget_name.strip_suffix("-title")
{
let tooltip_id = format!("{id}-tooltip");
if crate::localization::LANGUAGE_LOADER.has(&tooltip_id) {
box_element_btn.set_tooltip_text(Some(
&crate::localization::get_locale_text(&tooltip_id),
));
}
}
}
} else if let Some(section_label) = section_box_element.downcast_ref::<gtk::Label>() {
section_label.set_text(section_title);
Expand Down
30 changes: 29 additions & 1 deletion src/pages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod i18n;
mod tweaks;

use crate::ui::{Action, UI};
use crate::{actions, fl, systemd_units, utils};
use crate::{actions, fl, systemd_units, tsc_fix, utils};

use std::path::Path;
use std::str;
Expand Down Expand Up @@ -246,10 +246,38 @@ fn create_troubleshooting_section() -> gtk::Box {
button_box_t.pack_end(&kwinw_debug_btn, true, true, 2);
}

// TSC fix/undo gets a row of its own.
let button_box_tsc = gtk::Box::new(gtk::Orientation::Horizontal, 10);
if tsc_fix::is_applied() {
let tsc_revert_btn = create_gtk_button!("revert-tsc-warp-title");
tsc_revert_btn.set_tooltip_text(Some(&fl!("revert-tsc-warp-tooltip")));
tsc_revert_btn.connect_clicked(move |_| {
std::thread::spawn(move || {
actions::revert_tsc_directsync(crate::gui::run_command);
});
});
button_box_tsc.pack_start(&tsc_revert_btn, true, true, 2);
} else if tsc_fix::is_affected() || tsc_fix::is_active() {
// is_active(): undone but not rebooted yet, so no warp to detect.
let tsc_fix_btn = create_gtk_button!("fix-tsc-warp-title");
tsc_fix_btn.set_tooltip_text(Some(&fl!("fix-tsc-warp-tooltip")));
tsc_fix_btn.connect_clicked(move |_| {
std::thread::spawn(move || {
actions::apply_tsc_directsync(crate::gui::run_command);
});
});
button_box_tsc.pack_start(&tsc_fix_btn, true, true, 2);
}

button_box_f.set_halign(gtk::Align::Fill);
button_box_s.set_halign(gtk::Align::Fill);
button_box_t.set_halign(gtk::Align::Fill);

// pack_end stacks bottom-up, so this lands below button_box_t.
if !button_box_tsc.children().is_empty() {
button_box_tsc.set_halign(gtk::Align::Fill);
topbox.pack_end(&button_box_tsc, true, true, 5);
}
topbox.pack_end(&button_box_t, true, true, 5);
topbox.pack_end(&button_box_s, true, true, 5);
topbox.pack_end(&button_box_f, true, true, 5);
Expand Down
Loading