Update readme, slash configs

This commit is contained in:
Luke D. Jones
2025-01-12 17:36:10 +13:00
parent 2123f369ad
commit 128bc3fce1
113 changed files with 1545 additions and 1305 deletions

View File

@@ -23,5 +23,5 @@ pub struct CliStart {
help = "put ROGCC in layout viewing mode - this is helpful for finding existing layouts \
that might match your laptop"
)]
pub layout_viewing: bool,
pub layout_viewing: bool
}

View File

@@ -21,7 +21,7 @@ pub struct Config {
pub fullscreen_width: u32,
pub fullscreen_height: u32,
// This field must be last
pub notifications: EnabledNotifications,
pub notifications: EnabledNotifications
}
impl Default for Config {
@@ -36,7 +36,7 @@ impl Default for Config {
fullscreen_height: 1080,
notifications: EnabledNotifications::default(),
ac_command: String::new(),
bat_command: String::new(),
bat_command: String::new()
}
}
}
@@ -77,7 +77,7 @@ pub struct Config461 {
pub enable_dgpu_notifications: bool,
pub dark_mode: bool,
// This field must be last
pub enabled_notifications: EnabledNotifications,
pub enabled_notifications: EnabledNotifications
}
impl From<Config461> for Config {
@@ -92,7 +92,7 @@ impl From<Config461> for Config {
start_fullscreen: false,
fullscreen_width: 1920,
fullscreen_height: 1080,
notifications: c.enabled_notifications,
notifications: c.enabled_notifications
}
}
}

View File

@@ -9,7 +9,7 @@ pub enum Error {
ConfigLockFail,
XdgVars,
Zbus(zbus::Error),
Notification(notify_rust::error::Error),
Notification(notify_rust::error::Error)
}
impl fmt::Display for Error {
@@ -21,7 +21,7 @@ impl fmt::Display for Error {
Error::ConfigLockFail => write!(f, "Failed to lock user config"),
Error::XdgVars => write!(f, "XDG environment vars appear unset"),
Error::Zbus(err) => write!(f, "Error: {}", err),
Error::Notification(err) => write!(f, "Notification Error: {}", err),
Error::Notification(err) => write!(f, "Notification Error: {}", err)
}
}
}

View File

@@ -38,5 +38,5 @@ pub enum Page {
System,
AuraEffects,
AnimeMatrix,
FanCurves,
FanCurves
}

View File

@@ -17,7 +17,7 @@ use rog_control_center::slint::ComponentHandle;
use rog_control_center::tray::init_tray;
use rog_control_center::ui::setup_window;
use rog_control_center::zbus_proxies::{
AppState, ROGCCZbus, ROGCCZbusProxyBlocking, ZBUS_IFACE, ZBUS_PATH,
AppState, ROGCCZbus, ROGCCZbusProxyBlocking, ZBUS_IFACE, ZBUS_PATH
};
use rog_control_center::{print_versions, MainWindow};
use tokio::runtime::Runtime;

View File

@@ -5,7 +5,7 @@ use rog_aura::{AuraEffect, AuraModeNum, AuraZone};
use rog_platform::platform::GpuMode;
use rog_platform::supported::{
AdvancedAura, AnimeSupportedFunctions, ChargeSupportedFunctions, LedSupportedFunctions,
PlatformProfileFunctions, RogBiosSupportedFunctions, SupportedFunctions,
PlatformProfileFunctions, RogBiosSupportedFunctions, SupportedFunctions
};
use rog_profiles::fan_curve_set::{CurveData, FanCurveSet};
use supergfxctl::pci_device::{GfxMode, GfxPower};
@@ -16,7 +16,7 @@ const NOPE: &str = "";
#[derive(Default)]
pub struct DaemonProxyBlocking<'a> {
_phantom: &'a str,
_phantom: &'a str
}
impl<'a> DaemonProxyBlocking<'a> {
@@ -35,7 +35,7 @@ impl<'a> DaemonProxyBlocking<'a> {
#[derive(Default)]
pub struct RogDbusClientBlocking<'a> {
_phantom: &'a str,
_phantom: &'a str
}
impl<'a> RogDbusClientBlocking<'a> {
@@ -125,10 +125,18 @@ impl Profile {
pub fn fan_curve_data(&self, _p: rog_profiles::Profile) -> Result<FanCurveSet> {
let mut curve = FanCurveSet::default();
curve.cpu.pwm = [30, 40, 60, 100, 140, 180, 200, 250];
curve.cpu.temp = [20, 30, 40, 50, 70, 80, 90, 100];
curve.gpu.pwm = [40, 80, 100, 140, 170, 200, 230, 250];
curve.gpu.temp = [20, 30, 40, 50, 70, 80, 90, 100];
curve.cpu.pwm = [
30, 40, 60, 100, 140, 180, 200, 250
];
curve.cpu.temp = [
20, 30, 40, 50, 70, 80, 90, 100
];
curve.gpu.pwm = [
40, 80, 100, 140, 170, 200, 230, 250
];
curve.gpu.temp = [
20, 30, 40, 50, 70, 80, 90, 100
];
Ok(curve)
}
@@ -196,7 +204,7 @@ impl Led {
AuraDevRog2::AwakeKeyb,
AuraDevRog2::SleepLogo,
AuraDevRog2::AwakeLogo,
],
]
})
}
@@ -234,11 +242,11 @@ impl Supported {
Ok(SupportedFunctions {
anime_ctrl: AnimeSupportedFunctions(true),
charge_ctrl: ChargeSupportedFunctions {
charge_level_set: true,
charge_level_set: true
},
platform_profile: PlatformProfileFunctions {
platform_profile: true,
fan_curves: true,
fan_curves: true
},
keyboard_led: LedSupportedFunctions {
dev_id: AuraDevice::X19b6,
@@ -259,7 +267,7 @@ impl Supported {
AuraZone::BarRight,
AuraZone::Logo,
],
advanced_type: AdvancedAura::PerKey,
advanced_type: AdvancedAura::PerKey
},
rog_bios_ctrl: RogBiosSupportedFunctions {
post_sound: true,
@@ -267,8 +275,8 @@ impl Supported {
panel_overdrive: true,
dgpu_disable: true,
mini_led_mode: true,
egpu_enable: true,
},
egpu_enable: true
}
})
}
}

View File

@@ -32,7 +32,7 @@ const NOTIF_HEADER: &str = "ROG Control";
pub struct EnabledNotifications {
pub enabled: bool,
pub receive_notify_gfx: bool,
pub receive_notify_gfx_status: bool,
pub receive_notify_gfx_status: bool
}
impl Default for EnabledNotifications {
@@ -40,7 +40,7 @@ impl Default for EnabledNotifications {
Self {
enabled: true,
receive_notify_gfx: true,
receive_notify_gfx_status: true,
receive_notify_gfx_status: true
}
}
}
@@ -93,7 +93,7 @@ fn start_dpu_status_mon(config: Arc<Mutex<Config>>) {
pub fn start_notifications(
config: Arc<Mutex<Config>>,
rt: &Runtime,
rt: &Runtime
) -> Result<Vec<JoinHandle<()>>> {
// Setup the AC/BAT commands that will run on power status change
let config_copy = config.clone();
@@ -213,7 +213,7 @@ pub fn start_notifications(
supergfxctl::actions::UserActionRequired::Reboot => {
do_mux_notification("Graphics mode change requires reboot", &mode)
}
_ => do_gfx_action_notif(<&str>::from(action), *action, mode),
_ => do_gfx_action_notif(<&str>::from(action), *action, mode)
}
.map_err(|e| {
error!("zbus signal: do_gfx_action_notif: {e}");
@@ -265,13 +265,13 @@ fn convert_gfx_mode(gfx: GfxMode) -> GpuMode {
GfxMode::Vfio => GpuMode::Vfio,
GfxMode::AsusEgpu => GpuMode::Egpu,
GfxMode::AsusMuxDgpu => GpuMode::Ultimate,
GfxMode::None => GpuMode::Error,
GfxMode::None => GpuMode::Error
}
}
fn base_notification<T>(message: &str, data: &T) -> Notification
where
T: Display,
T: Display
{
let mut notif = Notification::new();
notif
@@ -289,7 +289,7 @@ fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Notification {
GfxPower::Off => "asus_notif_green",
GfxPower::AsusDisabled => "asus_notif_white",
GfxPower::AsusMuxDiscreet | GfxPower::Active => "asus_notif_red",
GfxPower::Unknown => "gpu-integrated",
GfxPower::Unknown => "gpu-integrated"
};
notif.icon(icon);
notif
@@ -329,7 +329,9 @@ fn do_gfx_action_notif(message: &str, action: GfxUserAction, mode: GpuMode) -> R
handle.wait_for_action(|id| {
if id == "gfx-mode-session-action" {
let mut cmd = Command::new("qdbus");
cmd.args(["org.kde.ksmserver", "/KSMServer", "logout", "1", "0", "0"]);
cmd.args([
"org.kde.ksmserver", "/KSMServer", "logout", "1", "0", "0"
]);
cmd.spawn().ok();
} else if id == "__closed" {
// TODO: cancel the switching
@@ -371,7 +373,9 @@ fn do_mux_notification(message: &str, m: &GpuMode) -> Result<()> {
handle.wait_for_action(|id| {
if id == "gfx-mode-session-action" {
let mut cmd = Command::new("qdbus");
cmd.args(["org.kde.ksmserver", "/KSMServer", "logout", "1", "1", "0"]);
cmd.args([
"org.kde.ksmserver", "/KSMServer", "logout", "1", "1", "0"
]);
cmd.spawn().ok();
} else if id == "__closed" {
// TODO: cancel the switching

View File

@@ -24,7 +24,7 @@ struct Icons {
rog_red: Icon,
rog_green: Icon,
rog_white: Icon,
gpu_integrated: Icon,
gpu_integrated: Icon
}
static ICONS: OnceLock<Icons> = OnceLock::new();
@@ -48,14 +48,14 @@ fn read_icon(file: &Path) -> Icon {
Icon {
width: width as i32,
height: height as i32,
data: img.into_raw(),
data: img.into_raw()
}
}
struct AsusTray {
current_title: String,
current_icon: Icon,
proxy: ROGCCZbusProxyBlocking<'static>,
proxy: ROGCCZbusProxyBlocking<'static>
}
impl ksni::Tray for AsusTray {
@@ -103,7 +103,7 @@ async fn set_tray_icon_and_tip(
mode: GfxMode,
power: GfxPower,
tray: &mut Handle<AsusTray>,
supergfx_active: bool,
supergfx_active: bool
) {
if let Some(icons) = ICONS.get() {
let icon = match power {
@@ -163,7 +163,7 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
let tray = AsusTray {
current_title: TRAY_LABEL.to_string(),
current_icon: rog_red.clone(),
proxy,
proxy
};
let mut tray = tray
@@ -186,7 +186,7 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
rog_red: rog_red.clone(),
rog_green,
rog_white,
gpu_integrated,
gpu_integrated
});
let mut has_supergfx = false;
@@ -207,7 +207,7 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
}
}
}
Err(e) => warn!("Couldn't get mode form supergfxd: {e:?}"),
Err(e) => warn!("Couldn't get mode form supergfxd: {e:?}")
}
info!("Started ROGTray");

View File

@@ -1,6 +1,6 @@
use crate::slint_generatedMainWindow::{
AuraDevType as SlintDeviceType, AuraPowerState as SlintAuraPowerState,
LaptopAuraPower as SlintLaptopAuraPower,
LaptopAuraPower as SlintLaptopAuraPower
};
impl From<rog_aura::AuraEffect> for crate::slint_generatedMainWindow::AuraEffect {
@@ -10,20 +10,20 @@ impl From<rog_aura::AuraEffect> for crate::slint_generatedMainWindow::AuraEffect
red: m.colour1.r,
green: m.colour1.g,
blue: m.colour1.b,
alpha: 255,
alpha: 255
}
.into(),
colour2: RgbaColor {
red: m.colour2.r,
green: m.colour2.g,
blue: m.colour2.b,
alpha: 255,
alpha: 255
}
.into(),
direction: m.direction.into(),
mode: m.mode.into(),
speed: m.speed.into(),
zone: m.zone.into(),
zone: m.zone.into()
}
}
}
@@ -36,17 +36,17 @@ impl From<crate::slint_generatedMainWindow::AuraEffect> for rog_aura::AuraEffect
colour1: rog_aura::Colour {
r: c1.red,
g: c1.green,
b: c1.blue,
b: c1.blue
},
colour2: rog_aura::Colour {
r: c2.red,
g: c2.green,
b: c2.blue,
b: c2.blue
},
direction: m.direction.into(),
mode: m.mode.into(),
speed: m.speed.into(),
zone: m.zone.into(),
zone: m.zone.into()
}
}
}
@@ -66,7 +66,7 @@ impl From<PowerZones> for SlintPowerZones {
PowerZones::RearGlow => SlintPowerZones::RearGlow,
PowerZones::KeyboardAndLightbar => SlintPowerZones::KeyboardAndLightbar,
PowerZones::Ally => SlintPowerZones::Ally,
PowerZones::None => SlintPowerZones::Keyboard,
PowerZones::None => SlintPowerZones::Keyboard
}
}
}
@@ -80,7 +80,7 @@ impl From<SlintPowerZones> for PowerZones {
SlintPowerZones::Lid => PowerZones::Lid,
SlintPowerZones::RearGlow => PowerZones::RearGlow,
SlintPowerZones::KeyboardAndLightbar => PowerZones::KeyboardAndLightbar,
SlintPowerZones::Ally => PowerZones::Ally,
SlintPowerZones::Ally => PowerZones::Ally
}
}
}
@@ -92,7 +92,7 @@ impl From<SlintAuraPowerState> for AuraPowerState {
boot: value.boot,
awake: value.awake,
sleep: value.sleep,
shutdown: value.shutdown,
shutdown: value.shutdown
}
}
}
@@ -106,7 +106,7 @@ impl From<AuraPowerState> for SlintAuraPowerState {
sleep: value.sleep,
shutdown: value.shutdown,
zone,
zone_name_idx: zone as i32,
zone_name_idx: zone as i32
}
}
}
@@ -120,7 +120,7 @@ impl From<&AuraPowerState> for SlintAuraPowerState {
sleep: value.sleep,
shutdown: value.shutdown,
zone,
zone_name_idx: zone as i32,
zone_name_idx: zone as i32
}
}
}
@@ -140,7 +140,7 @@ impl From<LaptopAuraPower> for SlintLaptopAuraPower {
let converted: Vec<SlintAuraPowerState> =
value.states.iter().map(SlintAuraPowerState::from).collect();
Self {
states: ModelRc::from(converted.as_slice()),
states: ModelRc::from(converted.as_slice())
}
}
}
@@ -154,7 +154,7 @@ impl From<SlintDeviceType> for AuraDeviceType {
SlintDeviceType::ScsiExtDisk => Self::ScsiExtDisk,
SlintDeviceType::Unknown => Self::Unknown,
SlintDeviceType::Ally => Self::Ally,
SlintDeviceType::AnimeOrSlash => Self::AnimeOrSlash,
SlintDeviceType::AnimeOrSlash => Self::AnimeOrSlash
}
}
}
@@ -168,7 +168,7 @@ impl From<AuraDeviceType> for SlintDeviceType {
AuraDeviceType::ScsiExtDisk => SlintDeviceType::ScsiExtDisk,
AuraDeviceType::Unknown => SlintDeviceType::Unknown,
AuraDeviceType::Ally => SlintDeviceType::Ally,
AuraDeviceType::AnimeOrSlash => SlintDeviceType::AnimeOrSlash,
AuraDeviceType::AnimeOrSlash => SlintDeviceType::AnimeOrSlash
}
}
}

View File

@@ -8,7 +8,7 @@ impl From<Profile> for ThrottlePolicy {
match value {
Profile::Balanced => ThrottlePolicy::Balanced,
Profile::Performance => ThrottlePolicy::Performance,
Profile::Quiet => ThrottlePolicy::Quiet,
Profile::Quiet => ThrottlePolicy::Quiet
}
}
}
@@ -18,7 +18,7 @@ impl From<ThrottlePolicy> for Profile {
match value {
ThrottlePolicy::Balanced => Profile::Balanced,
ThrottlePolicy::Performance => Profile::Performance,
ThrottlePolicy::Quiet => Profile::Quiet,
ThrottlePolicy::Quiet => Profile::Quiet
}
}
}
@@ -28,7 +28,7 @@ impl From<FanType> for FanCurvePU {
match value {
FanType::CPU => FanCurvePU::CPU,
FanType::Middle => FanCurvePU::MID,
FanType::GPU => FanCurvePU::GPU,
FanType::GPU => FanCurvePU::GPU
}
}
}
@@ -38,7 +38,7 @@ impl From<FanCurvePU> for FanType {
match value {
FanCurvePU::CPU => FanType::CPU,
FanCurvePU::GPU => FanType::GPU,
FanCurvePU::MID => FanType::Middle,
FanCurvePU::MID => FanType::Middle
}
}
}

View File

@@ -67,7 +67,7 @@ pub fn show_toast(
success: SharedString,
fail: SharedString,
handle: Weak<MainWindow>,
result: zbus::Result<()>,
result: zbus::Result<()>
) {
match result {
Ok(_) => {
@@ -77,7 +77,7 @@ pub fn show_toast(
log::warn!("{fail}: {e}");
handle.unwrap().invoke_show_toast(fail)
})
.ok(),
.ok()
};
}
@@ -102,9 +102,9 @@ pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
available.contains(&"xyz.ljones.Anime".to_string()),
available.contains(&"xyz.ljones.FanCurves".to_string()),
true,
true,
true
]
.into(),
.into()
);
ui.on_exit_app(move || {

View File

@@ -52,9 +52,9 @@ pub fn setup_anime_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
boot: boot.into(),
awake: awake.into(),
sleep: sleep.into(),
shutdown: shutdown.into(),
shutdown: shutdown.into()
})
.await,
.await
);
});
});

View File

@@ -9,7 +9,7 @@ use slint::{ComponentHandle, Model, RgbaColor, SharedString};
use crate::config::Config;
use crate::ui::show_toast;
use crate::{
set_ui_callbacks, set_ui_props_async, AuraPageData, MainWindow, PowerZones as SlintPowerZones,
set_ui_callbacks, set_ui_props_async, AuraPageData, MainWindow, PowerZones as SlintPowerZones
};
fn decode_hex(s: &str) -> RgbaColor<u8> {
@@ -19,7 +19,7 @@ fn decode_hex(s: &str) -> RgbaColor<u8> {
alpha: 255,
red: 0,
green: 0,
blue: 0,
blue: 0
};
}
let c: Vec<u8> = (0..s.len())
@@ -30,7 +30,7 @@ fn decode_hex(s: &str) -> RgbaColor<u8> {
alpha: 255,
red: *c.first().unwrap_or(&255),
green: *c.get(1).unwrap_or(&128),
blue: *c.get(2).unwrap_or(&32),
blue: *c.get(2).unwrap_or(&32)
}
}
@@ -198,7 +198,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
"Aura power settings changed".into(),
"Failed to set Aura power settings".into(),
handle_copy,
proxy_copy.set_led_power(power).await,
proxy_copy.set_led_power(power).await
);
});
});

View File

@@ -13,7 +13,7 @@ pub fn update_fan_data(
handle: Weak<MainWindow>,
bal: Vec<CurveData>,
perf: Vec<CurveData>,
quiet: Vec<CurveData>,
quiet: Vec<CurveData>
) {
handle
.upgrade_in_event_loop(move |handle| {
@@ -24,7 +24,7 @@ pub fn update_fan_data(
.zip(pwm.iter())
.map(|(x, y)| Node {
x: *x as f32,
y: *y as f32,
y: *y as f32
})
.collect();
tmp.as_slice().into()
@@ -199,6 +199,6 @@ fn fan_data_for(fan: FanType, enabled: bool, data: Vec<Node>) -> CurveData {
fan: fan.into(),
pwm,
temp,
enabled,
enabled
}
}

View File

@@ -15,7 +15,7 @@ use crate::{set_ui_props_async, AttrMinMax, MainWindow, SystemPageData};
const MINMAX: AttrMinMax = AttrMinMax {
min: 0,
max: 0,
val: -1.0,
val: -1.0
};
pub fn setup_system_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {

View File

@@ -14,17 +14,18 @@ pub enum AppState {
MainWindowClosed = 2,
StartingUp = 3,
QuitApp = 4,
LockFailed = 5,
LockFailed = 5
}
pub struct ROGCCZbus {
state: Arc<Mutex<AppState>>,
state: Arc<Mutex<AppState>>
}
impl ROGCCZbus {
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
Self {
state: Arc::new(Mutex::new(AppState::StartingUp)),
state: Arc::new(Mutex::new(AppState::StartingUp))
}
}
@@ -71,7 +72,7 @@ pub trait ROGCCZbus {
pub fn find_iface<T>(iface_name: &str) -> Result<Vec<T>, Box<dyn std::error::Error>>
where
T: ProxyImpl<'static> + From<zbus::Proxy<'static>>,
T: ProxyImpl<'static> + From<zbus::Proxy<'static>>
{
let conn = Connection::system().unwrap();
let f = fdo::ObjectManagerProxy::new(&conn, "xyz.ljones.Asusd", "/").unwrap();
@@ -98,7 +99,7 @@ where
T::builder(&conn)
.path(path.clone())?
.destination("xyz.ljones.Asusd")?
.build()?,
.build()?
);
}
return Ok(ctrl);
@@ -109,7 +110,7 @@ where
pub async fn find_iface_async<T>(iface_name: &str) -> Result<Vec<T>, Box<dyn std::error::Error>>
where
T: zbus::proxy::ProxyImpl<'static> + From<zbus::Proxy<'static>>,
T: zbus::proxy::ProxyImpl<'static> + From<zbus::Proxy<'static>>
{
let conn = zbus::Connection::system().await.unwrap();
let f = zbus::fdo::ObjectManagerProxy::new(&conn, "xyz.ljones.Asusd", "/")
@@ -139,7 +140,7 @@ where
.path(path.clone())?
.destination("xyz.ljones.Asusd")?
.build()
.await?,
.await?
);
}
return Ok(ctrl);