Cleanup files, prep new release

This commit is contained in:
Luke D. Jones
2024-05-05 20:22:56 +12:00
parent 487d140bd5
commit 1c8e50843b
32 changed files with 616 additions and 1848 deletions

View File

@@ -74,7 +74,7 @@ pub struct Config461 {
pub startup_in_background: bool,
pub ac_command: String,
pub bat_command: String,
pub enable_notifications: bool,
pub enable_dgpu_notifications: bool,
pub dark_mode: bool,
// This field must be last
pub enabled_notifications: EnabledNotifications,

View File

@@ -94,28 +94,34 @@ fn set_tray_icon_and_tip(
supergfx_active: bool,
) {
if let Some(icons) = ICONS.get() {
match power {
GfxPower::Suspended => tray.set_icon(Some(icons.rog_blue.clone())),
let icon = match power {
GfxPower::Suspended => icons.rog_blue.clone(),
GfxPower::Off => {
if mode == GfxMode::Vfio {
tray.set_icon(Some(icons.rog_red.clone()))
icons.rog_red.clone()
} else {
tray.set_icon(Some(icons.rog_green.clone()))
icons.rog_green.clone()
}
}
GfxPower::AsusDisabled => tray.set_icon(Some(icons.rog_white.clone())),
GfxPower::AsusMuxDiscreet | GfxPower::Active => {
tray.set_icon(Some(icons.rog_red.clone()));
}
GfxPower::AsusDisabled => icons.rog_white.clone(),
GfxPower::AsusMuxDiscreet | GfxPower::Active => icons.rog_red.clone(),
GfxPower::Unknown => {
if supergfx_active {
tray.set_icon(Some(icons.gpu_integrated.clone()));
icons.gpu_integrated.clone()
} else {
tray.set_icon(Some(icons.rog_red.clone()));
icons.rog_red.clone()
}
}
};
// *tray = TrayIconBuilder::<TrayAction>::new()
// .with_icon(icon)
// .with_tooltip(format!("ROG: gpu mode = {mode:?}, gpu power = {power:?}"))
// .with_menu(build_menu())
// .build(do_action)
// .map_err(|e| log::error!("Tray unable to be initialised: {e:?}"))
// .unwrap();
tray.set_icon(Some(icon));
tray.set_tooltip(format!("ROG: gpu mode = {mode:?}, gpu power = {power:?}"));
}
}
@@ -164,6 +170,7 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
};
info!("Started ROGTray");
let mut last_power = GfxPower::Unknown;
loop {
if let Ok(lock) = config.try_lock() {
if !lock.enable_tray_icon {
@@ -172,10 +179,13 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
}
if let Ok(mode) = gfx_proxy.mode() {
if let Ok(power) = gfx_proxy.power() {
set_tray_icon_and_tip(mode, power, &mut tray, supergfx_active);
if last_power != power {
set_tray_icon_and_tip(mode, power, &mut tray, supergfx_active);
last_power = power;
}
}
}
sleep(Duration::from_millis(50));
sleep(Duration::from_millis(500));
}
}
});

View File

@@ -164,7 +164,7 @@ pub fn setup_app_settings_page(ui: &MainWindow, config: Arc<Mutex<Config>>) {
}
});
let config_copy = config.clone();
global.on_set_enable_notifications(move |enable| {
global.on_set_enable_dgpu_notifications(move |enable| {
if let Ok(mut lock) = config_copy.try_lock() {
lock.notifications.enabled = enable;
lock.write();
@@ -175,6 +175,6 @@ pub fn setup_app_settings_page(ui: &MainWindow, config: Arc<Mutex<Config>>) {
global.set_run_in_background(lock.run_in_background);
global.set_startup_in_background(lock.startup_in_background);
global.set_enable_tray_icon(lock.enable_tray_icon);
global.set_enable_notifications(lock.notifications.enabled);
global.set_enable_dgpu_notifications(lock.notifications.enabled);
}
}

View File

@@ -34,7 +34,11 @@ fn decode_hex(s: &str) -> RgbaColor<u8> {
pub fn has_aura_iface_blocking() -> Result<bool, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system()?;
let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/org")?;
let f = zbus::blocking::fdo::ObjectManagerProxy::new(
&conn,
"org.asuslinux.Daemon",
"/org/asuslinux",
)?;
let interfaces = f.get_managed_objects()?;
let mut aura_paths = Vec::new();
for v in interfaces.iter() {
@@ -51,7 +55,8 @@ pub fn has_aura_iface_blocking() -> Result<bool, Box<dyn std::error::Error>> {
// TODO: return all
async fn find_aura_iface() -> Result<AuraProxy<'static>, Box<dyn std::error::Error>> {
let conn = zbus::Connection::system().await?;
let f = zbus::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/org").await?;
let f =
zbus::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/org/asuslinux").await?;
let interfaces = f.get_managed_objects().await?;
let mut aura_paths = Vec::new();
for v in interfaces.iter() {

View File

@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-05-04 22:54+0000\n"
"POT-Creation-Date: 2024-05-05 08:22+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"
@@ -154,7 +154,7 @@ msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:59
msgctxt "PageAppSettings"
msgid "Enable change notifications"
msgid "Enable dGPU notifications"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:27

View File

@@ -15,6 +15,11 @@ export component PageAbout inherits VerticalLayout {
VerticalBox {
alignment: LayoutAlignment.center;
Text {
wrap: TextWrap.word-wrap;
text: "You will require these patches: https://lore.kernel.org/platform-driver-x86/20240404001652.86207-1-luke@ljones.dev/, they have been merged upstream for kernel 6.10. The main thing is that the PPT settings will apply without them, but the read/back will fail";
}
Text {
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;

View File

@@ -8,8 +8,8 @@ export global AppSettingsPageData {
callback set_startup_in_background(bool);
in-out property <bool> enable_tray_icon;
callback set_enable_tray_icon(bool);
in-out property <bool> enable_notifications;
callback set_enable_notifications(bool);
in-out property <bool> enable_dgpu_notifications;
callback set_enable_dgpu_notifications(bool);
}
export component PageAppSettings inherits VerticalLayout {
@@ -56,10 +56,10 @@ export component PageAppSettings inherits VerticalLayout {
SystemToggle {
width: parent.width * 1px / 2px;
text: @tr("Enable change notifications");
checked <=> AppSettingsPageData.enable_notifications;
text: @tr("Enable dGPU notifications");
checked <=> AppSettingsPageData.enable_dgpu_notifications;
toggled => {
AppSettingsPageData.set_enable_notifications(AppSettingsPageData.enable_notifications)
AppSettingsPageData.set_enable_dgpu_notifications(AppSettingsPageData.enable_dgpu_notifications)
}
}
}