Merge branch 'main' into 'main'

feat: Allow setting default profile for ac and battery

See merge request asus-linux/asusctl!229
This commit is contained in:
Denis Benato
2025-11-05 18:53:53 +00:00
2 changed files with 13 additions and 1 deletions

View File

@@ -74,6 +74,12 @@ pub struct ProfileCommand {
#[options(meta = "", help = "set the active profile")]
pub profile_set: Option<PlatformProfile>,
#[options(short = "a", meta = "", help = "set the profile to use on AC power")]
pub profile_set_ac: Option<PlatformProfile>,
#[options(short = "b", meta = "", help = "set the profile to use on battery power")]
pub profile_set_bat: Option<PlatformProfile>,
}
#[derive(Options)]

View File

@@ -979,7 +979,7 @@ fn handle_throttle_profile(
return Err(ProfileError::NotSupported.into());
}
if !cmd.next && !cmd.list && cmd.profile_set.is_none() && !cmd.profile_get {
if !cmd.next && !cmd.list && cmd.profile_set.is_none() && !cmd.profile_get && cmd.profile_set_ac.is_none() && cmd.profile_set_bat.is_none() {
if !cmd.help {
println!("Missing arg or command\n");
}
@@ -999,6 +999,10 @@ fn handle_throttle_profile(
proxy.set_platform_profile(PlatformProfile::next(current, &choices))?;
} else if let Some(profile) = cmd.profile_set {
proxy.set_platform_profile(profile)?;
} else if let Some(profile) = cmd.profile_set_ac {
proxy.set_platform_profile_on_ac(profile)?;
} else if let Some(profile) = cmd.profile_set_bat {
proxy.set_platform_profile_on_battery(profile)?;
}
if cmd.list {
@@ -1009,6 +1013,8 @@ fn handle_throttle_profile(
if cmd.profile_get {
println!("Active profile is {current:?}");
println!("Profile on AC is {:?}", proxy.platform_profile_on_ac()?);
println!("Profile on Battery is {:?}", proxy.platform_profile_on_battery()?);
}
Ok(())