elkowar / eww

ElKowars wacky widgets
https://elkowar.github.io/eww
MIT License
8.78k stars 366 forks source link

Add `min` and `max` simplexpr functions #1123

Closed ovalkonia closed 18 hours ago

ovalkonia commented 2 weeks ago

Description

Pretty self-explanatory, adds min and max simplexpr functions. It might be useful sometimes, so why not!

Resolves https://github.com/elkowar/eww/issues/1122

Usage

The usage is the same as with other simplexpr function calls. The syntax would be min(a, b) and max(a, b), where a and b must both be convertible into f64. Here is a configuration used in the showcase below:

(defwidget ftest []
    (box
        :halign "center"
        :spacing "50"
        :space-evenly "false"
        "min(-9.591, 15.3) = ${min(-9.591, 15.3)}"
        "max(5, 4.7) = ${max(5, 4.7)}"))

(defwindow example
    :monitor "0"
    :geometry (geometry
        :x "0"
        :y "0"
        :width "100%"
        :height "35px"
        :anchor "top center")
    :exclusive "true"
    (ftest))

Showcase

1719010939

Additional Notes

N/A

Checklist

Please make sure you can check all the boxes that apply to this PR.