Skip to content

Commit

Permalink
Simplified brightness coef
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikReider committed Apr 15, 2024
1 parent ac6c376 commit 1127176
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/global_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,11 @@ pub(crate) fn handle_application_args(
"brightness" => {
let value = child.value().str().unwrap_or("");

let coef: i32 = match value.get(..1) {
Some("+") => 1,
Some("-") => -1,
_ => 0,
};

match (value, value.parse::<i8>()) {
// Parse custom step values
(_, Ok(num)) => match coef {
1 => (ArgTypes::BrightnessRaise, Some(num.to_string())),
-1 => (ArgTypes::BrightnessLower, Some(num.abs().to_string())),
(_, Ok(num)) => match value.get(..1) {
Some("+") => (ArgTypes::BrightnessRaise, Some(num.to_string())),
Some("-") => (ArgTypes::BrightnessLower, Some(num.abs().to_string())),
_ => (ArgTypes::BrightnessSet, Some(num.to_string())),
},

Expand Down

0 comments on commit 1127176

Please sign in to comment.