feature: rework PPT tuning handling more

1. Per profile, per-ac/dc
2. Do not apply unless group is enabled
3. Better reset/disable handling
4. Selecting a profile defaults PPT to off/disabled
This commit is contained in:
Luke D. Jones
2025-01-20 22:03:39 +13:00
parent 25823dc6b7
commit 911ff8690e
14 changed files with 351 additions and 122 deletions

View File

@@ -1,7 +1,6 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=ROG Control Center
Comment=Make your ASUS ROG Laptop go Brrrrr!
Categories=Settings

View File

@@ -6,6 +6,7 @@ pub mod setup_system;
use std::sync::{Arc, Mutex};
use config_traits::StdConfig;
use log::warn;
use rog_dbus::list_iface_blocking;
use slint::{ComponentHandle, PhysicalSize, SharedString, Weak};
@@ -82,6 +83,9 @@ pub fn show_toast(
}
pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
slint::set_xdg_app_id("rog-control-center")
.map_err(warn!("Couldn't set application ID: {e:?}"))
.ok();
let ui = MainWindow::new().unwrap();
if let Ok(lock) = config.try_lock() {
let fullscreen = lock.start_fullscreen;

View File

@@ -288,9 +288,18 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
change_platform_profile_on_ac
);
set_ui_props_async!(handle, platform, SystemPageData, enable_ppt_group);
let platform_copy = platform.clone();
handle
.upgrade_in_event_loop(move |handle| {
set_ui_callbacks!(handle,
SystemPageData(as bool),
platform_copy.enable_ppt_group(as bool),
"Applied PPT group settings {}",
"Setting PPT group settings failed"
);
set_ui_callbacks!(handle,
SystemPageData(as f32),
platform_copy.charge_control_end_threshold(as u8),

View File

@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-01-20 00:43+0000\n"
"POT-Creation-Date: 2025-01-21 03:38+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -47,198 +47,203 @@ msgctxt "SystemPageData"
msgid "Power"
msgstr ""
#: rog-control-center/ui/pages/system.slint:139
#: rog-control-center/ui/pages/system.slint:142
msgctxt "PageSystem"
msgid "Power settings"
msgstr ""
#: rog-control-center/ui/pages/system.slint:144
#: rog-control-center/ui/pages/system.slint:147
msgctxt "PageSystem"
msgid "Charge limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:158
#: rog-control-center/ui/pages/system.slint:161
msgctxt "PageSystem"
msgid "Platform Profile"
msgstr ""
#: rog-control-center/ui/pages/system.slint:168
#: rog-control-center/ui/pages/system.slint:171
msgctxt "PageSystem"
msgid "Advanced"
msgstr ""
#: rog-control-center/ui/pages/system.slint:186
#: rog-control-center/ui/pages/system.slint:189
msgctxt "PageSystem"
msgid "Armoury settings"
msgstr ""
#: rog-control-center/ui/pages/system.slint:194
msgctxt "PageSystem"
msgid "Panel Overdrive"
msgstr ""
#: rog-control-center/ui/pages/system.slint:202
msgctxt "PageSystem"
msgid "MiniLED Mode"
msgstr ""
#: rog-control-center/ui/pages/system.slint:210
msgctxt "PageSystem"
msgid "POST boot sound"
msgstr ""
#: rog-control-center/ui/pages/system.slint:224
#: rog-control-center/ui/pages/system.slint:199
msgctxt "no_asus_armoury_driver_1"
msgid "The asus-armoury driver is not loaded"
msgstr ""
#: rog-control-center/ui/pages/system.slint:230
#: rog-control-center/ui/pages/system.slint:205
msgctxt "no_asus_armoury_driver_2"
msgid "For advanced features you will require a kernel with this driver added."
msgstr ""
#: rog-control-center/ui/pages/system.slint:241
msgctxt "ppt_warning"
msgid "The following settings may not be safe, please review the help."
#: rog-control-center/ui/pages/system.slint:216
msgctxt "PageSystem"
msgid "Panel Overdrive"
msgstr ""
#: rog-control-center/ui/pages/system.slint:246 rog-control-center/ui/pages/system.slint:247
#: rog-control-center/ui/pages/system.slint:224
msgctxt "PageSystem"
msgid "MiniLED Mode"
msgstr ""
#: rog-control-center/ui/pages/system.slint:232
msgctxt "PageSystem"
msgid "POST boot sound"
msgstr ""
#: rog-control-center/ui/pages/system.slint:248
msgctxt "ppt_warning"
msgid "The following settings are not applied until the toggle is enabled."
msgstr ""
#: rog-control-center/ui/pages/system.slint:253
msgctxt "ppt_group_enabled"
msgid "Enable Tuning"
msgstr ""
#: rog-control-center/ui/pages/system.slint:262 rog-control-center/ui/pages/system.slint:263
msgctxt "ppt_pl1_spl"
msgid "CPU Sustained Power Limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:248
#: rog-control-center/ui/pages/system.slint:264
msgctxt "ppt_pl1_spl_help"
msgid ""
"Long-term CPU power limit that affects sustained workload performance. "
"Higher values may increase heat and power consumption."
msgstr ""
#: rog-control-center/ui/pages/system.slint:263 rog-control-center/ui/pages/system.slint:264
#: rog-control-center/ui/pages/system.slint:279 rog-control-center/ui/pages/system.slint:280
msgctxt "ppt_pl2_sppt"
msgid "CPU Turbo Power Limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:265
#: rog-control-center/ui/pages/system.slint:281
msgctxt "ppt_pl2_sppt_help"
msgid ""
"Short-term CPU power limit for boost periods. Controls maximum power during "
"brief high-performance bursts."
msgstr ""
#: rog-control-center/ui/pages/system.slint:280 rog-control-center/ui/pages/system.slint:281
#: rog-control-center/ui/pages/system.slint:296 rog-control-center/ui/pages/system.slint:297
msgctxt "ppt_pl3_fppt"
msgid "CPU Fast Burst Power Limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:282
#: rog-control-center/ui/pages/system.slint:298
msgctxt "ppt_pl3_fppt_help"
msgid ""
"Ultra-short duration power limit for instantaneous CPU bursts. Affects "
"responsiveness during sudden workload spikes."
msgstr ""
#: rog-control-center/ui/pages/system.slint:296 rog-control-center/ui/pages/system.slint:297
#: rog-control-center/ui/pages/system.slint:312 rog-control-center/ui/pages/system.slint:313
msgctxt "ppt_fppt"
msgid "Fast Package Power Limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:298
#: rog-control-center/ui/pages/system.slint:314
msgctxt "ppt_fppt_help"
msgid ""
"Ultra-short duration power limit for system package. Controls maximum power "
"during millisecond-scale load spikes."
msgstr ""
#: rog-control-center/ui/pages/system.slint:313 rog-control-center/ui/pages/system.slint:314
#: rog-control-center/ui/pages/system.slint:329 rog-control-center/ui/pages/system.slint:330
msgctxt "ppt_apu_sppt"
msgid "APU Sustained Power Limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:315
#: rog-control-center/ui/pages/system.slint:331
msgctxt "ppt_apu_sppt_help"
msgid ""
"Long-term power limit for integrated graphics and CPU combined. Affects "
"sustained performance of APU-based workloads."
msgstr ""
#: rog-control-center/ui/pages/system.slint:330 rog-control-center/ui/pages/system.slint:331
#: rog-control-center/ui/pages/system.slint:346 rog-control-center/ui/pages/system.slint:347
msgctxt "ppt_platform_sppt"
msgid "Platform Sustained Power Limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:332
#: rog-control-center/ui/pages/system.slint:348
msgctxt "ppt_platform_sppt_help"
msgid ""
"Overall system power limit for sustained operations. Controls total platform "
"power consumption over extended periods."
msgstr ""
#: rog-control-center/ui/pages/system.slint:347 rog-control-center/ui/pages/system.slint:348
#: rog-control-center/ui/pages/system.slint:363 rog-control-center/ui/pages/system.slint:364
msgctxt "nv_dynamic_boost"
msgid "GPU Power Boost"
msgstr ""
#: rog-control-center/ui/pages/system.slint:349
#: rog-control-center/ui/pages/system.slint:365
msgctxt "nv_dynamic_boost_help"
msgid ""
"Additional power allocation for GPU dynamic boost. Higher values increase "
"GPU performance but generate more heat."
msgstr ""
#: rog-control-center/ui/pages/system.slint:364 rog-control-center/ui/pages/system.slint:365
#: rog-control-center/ui/pages/system.slint:380 rog-control-center/ui/pages/system.slint:381
msgctxt "nv_temp_target"
msgid "GPU Temperature Limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:366
#: rog-control-center/ui/pages/system.slint:382
msgctxt "nv_temp_target_help"
msgid ""
"Maximum GPU temperature threshold in Celsius. GPU will throttle to maintain "
"temperature below this limit."
msgstr ""
#: rog-control-center/ui/pages/system.slint:417
#: rog-control-center/ui/pages/system.slint:433
msgctxt "PageSystem"
msgid "Energy Performance Preference linked to Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:421
#: rog-control-center/ui/pages/system.slint:437
msgctxt "PageSystem"
msgid "Change EPP based on Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:429
#: rog-control-center/ui/pages/system.slint:445
msgctxt "PageSystem"
msgid "EPP for Balanced Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:439
#: rog-control-center/ui/pages/system.slint:455
msgctxt "PageSystem"
msgid "EPP for Performance Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:449
#: rog-control-center/ui/pages/system.slint:465
msgctxt "PageSystem"
msgid "EPP for Quiet Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:467
#: rog-control-center/ui/pages/system.slint:483
msgctxt "PageSystem"
msgid "Throttle Policy for power state"
msgstr ""
#: rog-control-center/ui/pages/system.slint:473
#: rog-control-center/ui/pages/system.slint:489
msgctxt "PageSystem"
msgid "Throttle Policy on Battery"
msgstr ""
#: rog-control-center/ui/pages/system.slint:483 rog-control-center/ui/pages/system.slint:504
#: rog-control-center/ui/pages/system.slint:499 rog-control-center/ui/pages/system.slint:520
msgctxt "PageSystem"
msgid "Enabled"
msgstr ""
#: rog-control-center/ui/pages/system.slint:494
#: rog-control-center/ui/pages/system.slint:510
msgctxt "PageSystem"
msgid "Throttle Policy on AC"
msgstr ""
@@ -728,42 +733,42 @@ msgctxt "confirm_reset"
msgid "Are you sure you want to reset this?"
msgstr ""
#: rog-control-center/ui/main_window.slint:51
#: rog-control-center/ui/main_window.slint:54
msgctxt "MainWindow"
msgid "ROG"
msgstr ""
#: rog-control-center/ui/main_window.slint:53
#: rog-control-center/ui/main_window.slint:56
msgctxt "Menu1"
msgid "System Control"
msgstr ""
#: rog-control-center/ui/main_window.slint:54
#: rog-control-center/ui/main_window.slint:57
msgctxt "Menu2"
msgid "Keyboard Aura"
msgstr ""
#: rog-control-center/ui/main_window.slint:55
#: rog-control-center/ui/main_window.slint:58
msgctxt "Menu3"
msgid "AniMe Matrix"
msgstr ""
#: rog-control-center/ui/main_window.slint:56
#: rog-control-center/ui/main_window.slint:59
msgctxt "Menu4"
msgid "Fan Curves"
msgstr ""
#: rog-control-center/ui/main_window.slint:57
#: rog-control-center/ui/main_window.slint:60
msgctxt "Menu5"
msgid "App Settings"
msgstr ""
#: rog-control-center/ui/main_window.slint:58
#: rog-control-center/ui/main_window.slint:61
msgctxt "Menu6"
msgid "About"
msgstr ""
#: rog-control-center/ui/main_window.slint:70
#: rog-control-center/ui/main_window.slint:73
msgctxt "MainWindow"
msgid "Quit App"
msgstr ""

View File

@@ -19,7 +19,10 @@ export { AppSize, AttrMinMax, SystemPageData, AnimePageData, AppSettingsPageData
export component MainWindow inherits Window {
title: "ROG Control";
default-font-family: "DejaVu Sans";
default-font-family: "Noto Sans";
default-font-size: 14px;
default-font-weight: 400;
icon: @image-url("../data/rog-control-center.png");
in property <[bool]> sidebar_items_avilable: [true, true, true, true, true, true];
private property <bool> show_notif;
private property <bool> fade_cover;

View File

@@ -1,5 +1,5 @@
import { SystemSlider, SystemDropdown, SystemToggle, SystemToggleInt } from "../widgets/common.slint";
import { Palette, HorizontalBox , VerticalBox, ScrollView, Slider, Button, Switch, ComboBox, GroupBox} from "std-widgets.slint";
import { Palette, HorizontalBox , VerticalBox, ScrollView, Slider, Button, Switch, ComboBox, GroupBox, StandardButton} from "std-widgets.slint";
export struct AttrMinMax {
min: int,
@@ -114,6 +114,9 @@ export global SystemPageData {
};
callback cb_nv_temp_target(int);
callback cb_default_nv_temp_target();
in-out property <bool> enable_ppt_group;
callback cb_enable_ppt_group(bool);
}
export component PageSystem inherits Rectangle {
@@ -187,6 +190,25 @@ export component PageSystem inherits Rectangle {
}
}
if !SystemPageData.asus_armoury_loaded: Rectangle {
border-width: 3px;
border-color: red;
max-height: 30px;
VerticalBox {
Text {
text: @tr("no_asus_armoury_driver_1" => "The asus-armoury driver is not loaded");
font-size: 16px;
horizontal-alignment: TextHorizontalAlignment.center;
}
Text {
text: @tr("no_asus_armoury_driver_2" => "For advanced features you will require a kernel with this driver added.");
font-size: 16px;
horizontal-alignment: TextHorizontalAlignment.center;
}
}
}
HorizontalBox {
padding: 0px;
spacing: 10px;
@@ -215,30 +237,24 @@ export component PageSystem inherits Rectangle {
}
}
if !SystemPageData.asus_armoury_loaded: Rectangle {
border-width: 3px;
border-color: red;
max-height: 30px;
VerticalBox {
if SystemPageData.ppt_pl1_spl.val != -1 || SystemPageData.ppt_pl2_sppt.val != -1 || SystemPageData.nv_dynamic_boost.val != -1: HorizontalLayout {
padding-right: 10px;
padding-left: 10px;
alignment: LayoutAlignment.space-between;
Rectangle {
height: 32px;
Text {
text: @tr("no_asus_armoury_driver_1" => "The asus-armoury driver is not loaded");
font-size: 16px;
horizontal-alignment: TextHorizontalAlignment.center;
}
Text {
text: @tr("no_asus_armoury_driver_2" => "For advanced features you will require a kernel with this driver added.");
font-size: 16px;
horizontal-alignment: TextHorizontalAlignment.center;
text: @tr("ppt_warning" => "The following settings are not applied until the toggle is enabled.");
}
}
}
if SystemPageData.ppt_pl1_spl.val != -1: Rectangle {
height: 32px;
Text {
font-size: 16px;
text: @tr("ppt_warning" => "The following settings may not be safe, please review the help.");
Switch {
text: @tr("ppt_group_enabled" => "Enable Tuning");
checked <=> SystemPageData.enable_ppt_group;
toggled => {
SystemPageData.cb_enable_ppt_group(SystemPageData.enable_ppt_group)
}
}
}
@@ -255,7 +271,7 @@ export component PageSystem inherits Rectangle {
}
released => {
SystemPageData.ppt_pl1_spl.val = self.value;
SystemPageData.cb_ppt_pl1_spl(Math.round(self.value))
SystemPageData.cb_ppt_pl1_spl(Math.round(self.value));
}
}