Skip to content

Commit

Permalink
Fix small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
13r0ck committed Jun 14, 2023
1 parent 395e989 commit 8e79824
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ pub fn client(args: &Args) -> Result<(), String> {

match args {
Args::Profile { profile: name } => {
if client.get_desktop().unwrap_or(true) {
if client.get_desktop()? {
return Err(String::from(r#"
Power Profiles are not supported on Desktop computers.
Power profiles are not supported on Desktop computers.
"#));
}

Expand All @@ -193,7 +193,7 @@ Power Profiles are not supported on Desktop computers.
}
}
Args::Graphics { cmd } => {
if !client.get_switchable().unwrap_or(false) {
if !client.get_switchable()? {
return Err(String::from(r#"
Graphics switching is not supported on this device, because
this device is either a desktop or doesn't have both an iGPU and dGPU.
Expand All @@ -205,14 +205,9 @@ this device is either a desktop or doesn't have both an iGPU and dGPU.
Some(GraphicsArgs::Hybrid) => client.set_graphics("hybrid"),
Some(GraphicsArgs::Integrated) => client.set_graphics("integrated"),
Some(GraphicsArgs::Nvidia) => client.set_graphics("nvidia"),
Some(GraphicsArgs::Switchable) => {
if client.get_switchable()? {
println!("switchable");
} else {
println!("not switchable");
}
Ok(())
}
Some(GraphicsArgs::Switchable) => client
.get_switchable()
.map(|b| println!("{}", if b { "switchable" } else { "not switchable" })),
Some(GraphicsArgs::Power { state }) => match state.as_deref() {
Some("auto") => client.auto_graphics_power(),
Some("off") => client.set_graphics_power(false),
Expand Down

0 comments on commit 8e79824

Please sign in to comment.