mirror of
https://github.com/elkowar/eww.git
synced 2024-08-18 00:00:38 +03:00
Add min
and max
simplexpr functions (#1123)
* Add 'min' and 'max' function calls to simplexpr * Add changelog entry for 'min' and 'max' simplexpr functions
This commit is contained in:
parent
d1fde927d2
commit
4d55e9ad63
@ -11,6 +11,7 @@ All notable changes to eww will be listed here, starting at changes since versio
|
||||
### Features
|
||||
- Add `:truncate` property to labels, disabled by default (except in cases where truncation would be enabled in version `0.5.0` and before) (By: Rayzeq).
|
||||
- Add support for `:hover` css selectors for tray items (By: zeapoz)
|
||||
- Add `min` and `max` function calls to simplexpr (By: ovalkonia)
|
||||
|
||||
## [0.6.0] (21.04.2024)
|
||||
|
||||
|
@ -328,6 +328,22 @@ fn call_expr_function(name: &str, args: Vec<DynVal>) -> Result<DynVal, EvalError
|
||||
}
|
||||
_ => Err(EvalError::WrongArgCount(name.to_string())),
|
||||
},
|
||||
"min" => match args.as_slice() {
|
||||
[a, b] => {
|
||||
let a = a.as_f64()?;
|
||||
let b = b.as_f64()?;
|
||||
Ok(DynVal::from(f64::min(a, b)))
|
||||
}
|
||||
_ => Err(EvalError::WrongArgCount(name.to_string())),
|
||||
},
|
||||
"max" => match args.as_slice() {
|
||||
[a, b] => {
|
||||
let a = a.as_f64()?;
|
||||
let b = b.as_f64()?;
|
||||
Ok(DynVal::from(f64::max(a, b)))
|
||||
}
|
||||
_ => Err(EvalError::WrongArgCount(name.to_string())),
|
||||
},
|
||||
"sin" => match args.as_slice() {
|
||||
[num] => {
|
||||
let num = num.as_f64()?;
|
||||
|
Loading…
Reference in New Issue
Block a user