mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
feat: support TUF lighting power
This commit is contained in:
@@ -148,6 +148,12 @@ async fn main() -> Result<()> {
|
||||
}
|
||||
};
|
||||
|
||||
let is_tuf = {
|
||||
let b = board_name.to_lowercase();
|
||||
let p = prod_family.to_lowercase();
|
||||
b.contains("tuf") || p.contains("tuf")
|
||||
};
|
||||
|
||||
#[cfg(feature = "rog_ally")]
|
||||
if is_rog_ally {
|
||||
config.notifications.enabled = false;
|
||||
@@ -198,7 +204,7 @@ async fn main() -> Result<()> {
|
||||
loop {
|
||||
if is_rog_ally {
|
||||
let config_copy_2 = config.clone();
|
||||
let newui = setup_window(config.clone(), prefetched_supported.clone());
|
||||
let newui = setup_window(config.clone(), prefetched_supported.clone(), is_tuf);
|
||||
newui.window().on_close_requested(move || {
|
||||
exit(0);
|
||||
});
|
||||
@@ -256,7 +262,7 @@ async fn main() -> Result<()> {
|
||||
});
|
||||
} else {
|
||||
let config_copy_2 = config_copy.clone();
|
||||
let newui = setup_window(config_copy, pref_for_invoke.clone());
|
||||
let newui = setup_window(config_copy, pref_for_invoke.clone(), is_tuf);
|
||||
newui.window().on_close_requested(move || {
|
||||
if let Ok(mut app_state) = app_state_copy.lock() {
|
||||
*app_state = AppState::MainWindowClosed;
|
||||
|
||||
@@ -120,6 +120,7 @@ pub fn show_toast(
|
||||
pub fn setup_window(
|
||||
config: Arc<Mutex<Config>>,
|
||||
prefetched_supported: std::sync::Arc<Option<Vec<i32>>>,
|
||||
is_tuf: bool,
|
||||
) -> MainWindow {
|
||||
slint::set_xdg_app_id("rog-control-center")
|
||||
.map_err(|e| warn!("Couldn't set application ID: {e:?}"))
|
||||
@@ -127,6 +128,8 @@ pub fn setup_window(
|
||||
let ui = MainWindow::new()
|
||||
.map_err(|e| warn!("Couldn't create main window: {e:?}"))
|
||||
.unwrap();
|
||||
// propagate TUF flag to the UI so the sidebar can swap logo branding
|
||||
ui.set_is_tuf(is_tuf);
|
||||
ui.window()
|
||||
.show()
|
||||
.map_err(|e| warn!("Couldn't show main window: {e:?}"))
|
||||
|
||||
Reference in New Issue
Block a user