Files
eww/bar/widget.yuck
T
2023-07-29 18:56:09 -04:00

66 lines
1.9 KiB
Plaintext

(defvar eww "eww")
(defwidget metric [label value min max onchange]
(box :orientation "h"
:class "metric mod"
:space-evenly false
(box :class "label" label)
(scale :min min
:max max
:active {onchange != ""}
:value value
:onchange onchange)))
(defwidget hover-metric [icon value ?class revealname reveal onchange]
(eventbox :onhover "${eww} update ${revealname}=true"
:onhoverlost "${eww} update ${revealname}=false"
(box :orientation "h"
:class "metric mod"
:space-evenly false
(box :class {class ?: ""} {icon})
(revealer :transition "slideright"
:reveal reveal
:duration "300ms"
(scale :min 0
:max 100
:value value
:onchange onchange)))))
(defwidget hover-text [icon value ?class revealname reveal]
(eventbox :onhover "${eww} update ${revealname}=true"
:onhoverlost "${eww} update ${revealname}=false"
(box :orientation "h"
:class "metric mod"
:space-evenly false
(box :class {class ?: ""} {icon})
(revealer :transition "slideright"
:reveal net_reveal
:duration "300ms"
(label :text {value}
:class "purple")))))
(defwidget status [label poll]
(box :orientation "h"
:class "metric mod"
:space-evenly false
(box :class "label" label)
(text :poll poll)))
(defwidget text [poll]
(box :class "text mod"
poll))
(defwidget circle [value icon class]
(box :class "mod circle-progress"
(label :text icon
:class "${class}")
(circular-progress :value value
:width 25
:class "circle-bar ${class} bg"
:thickness 4
:start-at 75)))
(defwidget sep []
(label :text "" :class "sep"))