add quick actions tab
This commit is contained in:
@@ -4,9 +4,13 @@
|
||||
"scripts/weather")
|
||||
|
||||
(deflisten volume
|
||||
:initial '{"icon":"","percent":50,"sink_muted":false,"mic_icon":"","microphone":50,"source_muted":false}'
|
||||
: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 []
|
||||
@@ -14,9 +18,9 @@
|
||||
(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
|
||||
(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"
|
||||
@@ -40,13 +44,16 @@
|
||||
(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}%")))
|
||||
: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" :accent "vol-accent")
|
||||
(section-header
|
||||
:title {volume.sink != "" ? "Volume · ${volume.sink}" : "Volume"}
|
||||
:accent "vol-accent")
|
||||
(vol-row
|
||||
:icon {volume.icon}
|
||||
:value {volume.percent}
|
||||
@@ -60,13 +67,68 @@
|
||||
: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 "h" :homogeneous true :class "quick-grid"
|
||||
(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})
|
||||
(quick-btn
|
||||
:icon "" :label "Screenshot"
|
||||
:onclick "scripts/screenshot"
|
||||
: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")
|
||||
(calendar)
|
||||
(box :class "section-sep")
|
||||
(volume-section)))
|
||||
(box :orientation "v" :space-evenly false :class "sys-section cal-box"
|
||||
(section-header :title "Calendar" :accent "cal-accent")
|
||||
(calendar :show-week-numbers false))
|
||||
))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user