27 lines
1.3 KiB
Plaintext
27 lines
1.3 KiB
Plaintext
(defpoll vinfo
|
|
:initial "{\"volume\": 0, \"muted\": false}"
|
|
:interval "1s"
|
|
"bash ~/.config/eww/scripts/get-volume-info.sh")
|
|
(defvar volume-reveal false)
|
|
|
|
(defwidget volume-module []
|
|
(eventbox :onhover "${EWW_CMD} update volume-reveal=true"
|
|
:onhoverlost "${EWW_CMD} update volume-reveal=false"
|
|
(box :class "module volume"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:tooltip {vinfo.muted? "muted" : "Volume: ${vinfo.volume}%"}
|
|
(label :text {vinfo.muted ? "" : vinfo.volume < 10 ? "" : vinfo.volume < 70 ? "" : ""}
|
|
:class "volume icon ${vinfo.muted ? "volume-mute" : ""}")
|
|
(revealer :transition "slideleft"
|
|
:duration "750ms"
|
|
:reveal {volume-reveal && !vinfo.muted}
|
|
(scale :class "volume-bar"
|
|
:orientation "h"
|
|
:valign "center"
|
|
:width 60
|
|
:min 0
|
|
:max 101
|
|
:value {vinfo.volume}
|
|
:onchange "amixer sset Master {}% > /dev/null")))))
|