81 lines
2.4 KiB
Common Lisp
81 lines
2.4 KiB
Common Lisp
;; -*-lisp-*-
|
|
(deflisten volume--data
|
|
`~/.config/eww/scripts/volume.py`)
|
|
|
|
(defwidget volume-h []
|
|
(box :orientation "h"
|
|
:halign "start"
|
|
:class "module ${volume--data['mute'] ? 'offline' : ''}"
|
|
:space-evenly false
|
|
:spacing 0
|
|
(label :visible {!volume--data["mute"]} :text "")
|
|
(label :visible { volume--data["mute"]} :text "")
|
|
(label :text " ${volume--data['volume']}")))
|
|
|
|
(defwidget audio []
|
|
(box :orientation "v"
|
|
:halign "center"
|
|
:class "module text"
|
|
:space-evenly false
|
|
:spacing 0
|
|
(box :orientation "h"
|
|
:halign "center"
|
|
:space-evenly false
|
|
:spacing 15
|
|
(label :class {volume--data.output.mute ? "offline" : "special"}
|
|
:text "${volume--data.output.volume}%")
|
|
(label :class {volume--data.input.mute ? "offline" : "special"}
|
|
:text "${volume--data.input.volume}%"))
|
|
"audio system"))
|
|
|
|
(defwidget volume--gauge [io]
|
|
(box :orientation "v"
|
|
:halign {io == "in" ? "start" : "end"}
|
|
:width 95
|
|
:space-evenly false
|
|
:spacing 10
|
|
:class "nebula"
|
|
(label :text {io})
|
|
(box :halign "center"
|
|
(overlay
|
|
(system--gauge :value {volume--data["${io}put"].volume}
|
|
:threshold {volume--data["${io}put"].mute ? 0 : 100})
|
|
(transform :translate-y "-2px"
|
|
(box
|
|
(box :halign "center"
|
|
:valign "center"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:visible {!volume--data["${io}put"].mute}
|
|
(label :text "%"
|
|
:class "invisible")
|
|
(label :text {round(volume--data["${io}put"].volume, 0)}
|
|
:class "special")
|
|
(label :text "%"
|
|
:class "offline"))
|
|
(box :halign "center"
|
|
:valign "center"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:visible {volume--data["${io}put"].mute}
|
|
(label :text "mute"
|
|
:class "offline"))
|
|
))))))
|
|
|
|
(defwidget volume-gauges []
|
|
(box :orientation "v"
|
|
:space-evenly false
|
|
:spacing 10
|
|
:width 200
|
|
:halign "start"
|
|
:class "nebula"
|
|
(label :class "medium special"
|
|
:text "Audio")
|
|
(box :orientation "h"
|
|
:space-evenly false
|
|
:width 200
|
|
:halign "start"
|
|
:spacing 10
|
|
(volume--gauge :io "out")
|
|
(volume--gauge :io "in"))))
|