Weather&Audio
This commit is contained in:
72
modules/home/wayland/apps/eww/bar/windows/clock.yuck
Normal file
72
modules/home/wayland/apps/eww/bar/windows/clock.yuck
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
(deflisten weather
|
||||
:initial '{"temp":0,"feelslike":0,"humidity":0,"wind":0,"desc":"","icon":"","city":""}'
|
||||
"scripts/weather")
|
||||
|
||||
(deflisten volume
|
||||
:initial '{"icon":"","percent":50,"sink_muted":false,"mic_icon":"","microphone":50,"source_muted":false}'
|
||||
"scripts/volume")
|
||||
|
||||
; --- Weather ---
|
||||
|
||||
(defwidget weather-section []
|
||||
(box :orientation "v" :space-evenly false :class "sys-section"
|
||||
(section-header
|
||||
:title {weather.city != "" ? "Weather · ${weather.city}" : "Weather"}
|
||||
:accent "weather-accent")
|
||||
(box :orientation "h" :space-evenly false :valign "center" :class "weather-main"
|
||||
(label :class "weather-icon" :text {weather.icon})
|
||||
(box :orientation "v" :space-evenly false
|
||||
(label :class "weather-temp" :text "${weather.temp}°C")
|
||||
(label :class "weather-desc" :text {weather.desc})))
|
||||
(box :orientation "h" :space-evenly true :class "weather-stats"
|
||||
(box :orientation "v" :space-evenly false :halign "center"
|
||||
(label :class "gpu-stat-value" :text "${weather.feelslike}°C")
|
||||
(label :class "gpu-stat-label" :text "feels like"))
|
||||
(box :orientation "v" :space-evenly false :halign "center"
|
||||
(label :class "gpu-stat-value" :text "${weather.humidity}%")
|
||||
(label :class "gpu-stat-label" :text "humidity"))
|
||||
(box :orientation "v" :space-evenly false :halign "center"
|
||||
(label :class "gpu-stat-value" :text "${weather.wind} km/h")
|
||||
(label :class "gpu-stat-label" :text "wind")))))
|
||||
|
||||
; --- Volume ---
|
||||
|
||||
(defwidget vol-row [icon value onchange onclick muted]
|
||||
(box :orientation "h" :space-evenly false :valign "center" :class "ctrl-row"
|
||||
(button
|
||||
:class "ctrl-icon ${muted ? 'ctrl-muted' : ''}"
|
||||
:onclick onclick
|
||||
(label :text icon))
|
||||
(scale
|
||||
:min 0 :max 100 :value value
|
||||
:hexpand true :class "ctrl-slider"
|
||||
:onchange onchange)
|
||||
(label :class "ctrl-value" :halign "end" :text "${value}%")))
|
||||
|
||||
(defwidget volume-section []
|
||||
(box :orientation "v" :space-evenly false :class "sys-section"
|
||||
(section-header :title "Volume" :accent "vol-accent")
|
||||
(vol-row
|
||||
:icon {volume.icon}
|
||||
:value {volume.percent}
|
||||
:muted {volume.sink_muted}
|
||||
:onchange "scripts/volume setvol SINK {}"
|
||||
:onclick "scripts/volume mute SINK")
|
||||
(vol-row
|
||||
:icon {volume.mic_icon}
|
||||
:value {volume.microphone}
|
||||
:muted {volume.source_muted}
|
||||
:onchange "scripts/volume setvol SOURCE {}"
|
||||
:onclick "scripts/volume mute SOURCE")))
|
||||
|
||||
; --- Root ---
|
||||
|
||||
(defwidget clock-win []
|
||||
(box :class "sys-win" :orientation "v" :space-evenly false
|
||||
(weather-section)
|
||||
(box :class "section-sep")
|
||||
(calendar)
|
||||
(box :class "section-sep")
|
||||
(volume-section)))
|
||||
|
||||
Reference in New Issue
Block a user