Reformat with trailing comma

This commit is contained in:
Luke Jones
2025-02-14 16:06:20 +13:00
parent 0bdf0474c9
commit 2c006699f2
113 changed files with 791 additions and 792 deletions

View File

@@ -18,7 +18,7 @@ fn main() {
CompilerConfiguration::new()
// .embed_resources(EmbedResourcesKind::EmbedFiles)
.with_include_paths(vec![include])
.with_style("fluent".into())
.with_style("fluent".into()),
)
.unwrap();
}

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> {
@@ -126,16 +126,16 @@ 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
30, 40, 60, 100, 140, 180, 200, 250,
];
curve.cpu.temp = [
20, 30, 40, 50, 70, 80, 90, 100
20, 30, 40, 50, 70, 80, 90, 100,
];
curve.gpu.pwm = [
40, 80, 100, 140, 170, 200, 230, 250
40, 80, 100, 140, 170, 200, 230, 250,
];
curve.gpu.temp = [
20, 30, 40, 50, 70, 80, 90, 100
20, 30, 40, 50, 70, 80, 90, 100,
];
Ok(curve)
}
@@ -204,7 +204,7 @@ impl Led {
AuraDevRog2::AwakeKeyb,
AuraDevRog2::SleepLogo,
AuraDevRog2::AwakeLogo,
]
],
})
}
@@ -242,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,
@@ -267,7 +267,7 @@ impl Supported {
AuraZone::BarRight,
AuraZone::Logo,
],
advanced_type: AdvancedAura::PerKey
advanced_type: AdvancedAura::PerKey,
},
rog_bios_ctrl: RogBiosSupportedFunctions {
post_sound: true,
@@ -275,8 +275,8 @@ impl Supported {
panel_overdrive: true,
dgpu_disable: true,
mini_led_mode: true,
egpu_enable: true
}
egpu_enable: true,
},
})
}
}

View File

@@ -31,7 +31,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 {
@@ -39,7 +39,7 @@ impl Default for EnabledNotifications {
Self {
enabled: true,
receive_notify_gfx: true,
receive_notify_gfx_status: true
receive_notify_gfx_status: true,
}
}
}
@@ -92,7 +92,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();
@@ -214,7 +214,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}");
@@ -266,13 +266,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
@@ -290,7 +290,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
@@ -331,7 +331,7 @@ fn do_gfx_action_notif(message: &str, action: GfxUserAction, mode: GpuMode) -> R
if id == "gfx-mode-session-action" {
let mut cmd = Command::new("qdbus");
cmd.args([
"org.kde.ksmserver", "/KSMServer", "logout", "1", "0", "0"
"org.kde.ksmserver", "/KSMServer", "logout", "1", "0", "0",
]);
cmd.spawn().ok();
} else if id == "__closed" {
@@ -375,7 +375,7 @@ fn do_mux_notification(message: &str, m: &GpuMode) -> Result<()> {
if id == "gfx-mode-session-action" {
let mut cmd = Command::new("qdbus");
cmd.args([
"org.kde.ksmserver", "/KSMServer", "logout", "1", "1", "0"
"org.kde.ksmserver", "/KSMServer", "logout", "1", "1", "0",
]);
cmd.spawn().ok();
} else if id == "__closed" {

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();
@@ -51,14 +51,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 {
@@ -106,7 +106,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 {
@@ -165,7 +165,7 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
let tray_init = AsusTray {
current_title: TRAY_LABEL.to_string(),
current_icon: rog_red.clone(),
proxy
proxy,
};
// TODO: return an error to the UI
@@ -190,7 +190,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;
@@ -218,8 +218,8 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
may not be running or installed"
)
}
_ => warn!("Couldn't get mode from supergfxd: {e:?}")
}
_ => warn!("Couldn't get mode from 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 PlatformProfile {
match value {
Profile::Balanced => PlatformProfile::Balanced,
Profile::Performance => PlatformProfile::Performance,
Profile::Quiet => PlatformProfile::Quiet
Profile::Quiet => PlatformProfile::Quiet,
}
}
}
@@ -18,7 +18,7 @@ impl From<PlatformProfile> for Profile {
match value {
PlatformProfile::Balanced => Profile::Balanced,
PlatformProfile::Performance => Profile::Performance,
PlatformProfile::Quiet => Profile::Quiet
PlatformProfile::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

@@ -68,7 +68,7 @@ pub fn show_toast(
success: SharedString,
fail: SharedString,
handle: Weak<MainWindow>,
result: zbus::Result<()>
result: zbus::Result<()>,
) {
match result {
Ok(_) => {
@@ -78,7 +78,7 @@ pub fn show_toast(
log::warn!("{fail}: {e}");
handle.unwrap().invoke_show_toast(fail)
})
.ok()
.ok(),
};
}
@@ -98,9 +98,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

@@ -51,9 +51,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

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

View File

@@ -14,18 +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)),
}
}
@@ -72,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();
@@ -99,7 +99,7 @@ where
T::builder(&conn)
.path(path.clone())?
.destination("xyz.ljones.Asusd")?
.build()?
.build()?,
);
}
return Ok(ctrl);
@@ -110,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", "/")
@@ -140,7 +140,7 @@ where
.path(path.clone())?
.destination("xyz.ljones.Asusd")?
.build()
.await?
.await?,
);
}
return Ok(ctrl);

View File

@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-02-10 09:04+0000\n"
"POT-Creation-Date: 2025-02-14 03:05+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"