127 lines
5.1 KiB
Plaintext
127 lines
5.1 KiB
Plaintext
|
|
(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,"sink":""}'
|
|
"scripts/volume")
|
|
|
|
(deflisten brightness
|
|
:initial '{"percent":0,"available":false}'
|
|
"scripts/brightness")
|
|
|
|
; --- 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 :halign "center" :class "weather-main"
|
|
(label :class "weather-icon" :valign "center" :text {weather.icon})
|
|
(box :orientation "v" :space-evenly false :valign "center"
|
|
(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 ${muted ? 'ctrl-slider-muted' : ''}"
|
|
:onchange {muted ? "true" : onchange})
|
|
(label :class "ctrl-value ${muted ? 'ctrl-muted' : ''}" :halign "end" :text "${value}%")))
|
|
|
|
(defwidget volume-section []
|
|
(box :orientation "v" :space-evenly false :class "sys-section"
|
|
(section-header
|
|
:title {volume.sink != "" ? "Volume · ${volume.sink}" : "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")))
|
|
|
|
; --- Quick Actions ---
|
|
|
|
(defvar power-save false)
|
|
(defvar night-light false)
|
|
|
|
(defwidget quick-btn [icon label onclick active]
|
|
(button :class "quick-btn ${active ? 'quick-btn-active' : ''}"
|
|
:onclick onclick
|
|
(box :orientation "v" :space-evenly false :halign "center" :valign "center"
|
|
(label :class "quick-icon" :text icon)
|
|
(label :class "quick-label" :text label))))
|
|
|
|
(defwidget quick-section []
|
|
(box :orientation "v" :space-evenly false :class "sys-section"
|
|
(section-header :title "Quick Actions" :accent "quick-accent")
|
|
(box :orientation "v" :space-evenly false :class "quick-grid" :spacing 4
|
|
(box :orientation "h" :space-evenly true
|
|
(quick-btn :icon "" :label "Wallpaper" :onclick "scripts/wallpaper" :active false)
|
|
(quick-btn :icon "" :label "Power Save" :onclick "eww update power-save=$(scripts/power-save)" :active {power-save})
|
|
(quick-btn :icon "" :label "Night Light" :onclick "eww update night-light=$(scripts/nightlight)" :active {night-light}))
|
|
(box :orientation "h" :space-evenly true
|
|
(quick-btn :icon "" :label "Screenshot" :onclick "scripts/screenshot" :active false)
|
|
(quick-btn :icon "" :label "Lock" :onclick "scripts/lock" :active false)
|
|
(quick-btn :icon "" :label "Color Pick" :onclick "scripts/color-pick" :active false)))))
|
|
|
|
; --- Brightness ---
|
|
|
|
(defwidget brightness-section []
|
|
(box :orientation "v" :space-evenly false :class "sys-section"
|
|
:visible {brightness.available}
|
|
(section-header :title "Brightness" :accent "bri-accent")
|
|
(box :orientation "h" :space-evenly false :valign "center" :class "ctrl-row"
|
|
(label :class "ctrl-icon" :text "")
|
|
(scale
|
|
:min 1 :max 100 :value {brightness.percent}
|
|
:hexpand true
|
|
:class "ctrl-slider"
|
|
:onchange "scripts/brightness set {}")
|
|
(label :class "ctrl-value" :halign "end" :text "${brightness.percent}%"))))
|
|
|
|
; --- Root ---
|
|
|
|
(defwidget clock-win []
|
|
(box :class "sys-win" :orientation "v" :space-evenly false
|
|
(volume-section)
|
|
(brightness-section)
|
|
(box :class "section-sep")
|
|
(quick-section)
|
|
(box :class "section-sep")
|
|
(weather-section)
|
|
(box :class "section-sep")
|
|
(box :orientation "v" :space-evenly false :class "sys-section cal-box"
|
|
(section-header :title "Calendar" :accent "cal-accent")
|
|
(calendar :show-week-numbers false))
|
|
))
|
|
|
|
|