mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Cleanup files, prep new release
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user