181 lines
4.3 KiB
Plaintext
181 lines
4.3 KiB
Plaintext
|
(defvar eww "eww --config $HOME/.config/eww/bar")
|
||
|
|
||
|
(defwindow bar
|
||
|
:exclusive true
|
||
|
:monitor 0
|
||
|
:windowtype "dock"
|
||
|
:geometry (geometry
|
||
|
:x "0%"
|
||
|
:y "0%"
|
||
|
:width "20px"
|
||
|
:height "100%"
|
||
|
:anchor "center left"
|
||
|
)
|
||
|
:reserve (struts :side "left" :distance "20px")
|
||
|
(widget_bar))
|
||
|
(defwidget widget_bar []
|
||
|
(centerbox :orientation "v"
|
||
|
(box :orientation "v" :space-evenly false :valign "start"
|
||
|
(box :class "launcher" :valign "start" "☯")
|
||
|
(widget_workspaces)
|
||
|
)
|
||
|
(widget_weather :orientation "v")
|
||
|
(widget_clock)
|
||
|
;(media)
|
||
|
;(widget_status)
|
||
|
))
|
||
|
|
||
|
(defwidget widget_weather [orientation]
|
||
|
(box
|
||
|
:class "weather"
|
||
|
:orientation orientation
|
||
|
:space-evenly false
|
||
|
:valign "start"
|
||
|
:halign "center"
|
||
|
:spacing 10
|
||
|
;(box :class "moon" :orientation "v" moon) ; Not very stable
|
||
|
(box :class "temperature" :orientation orientation
|
||
|
(box :class "icon" "")
|
||
|
"${weather.current_condition[0].temp_C}"
|
||
|
(box :class "feelsLike" "${weather.current_condition[0].FeelsLikeC}")
|
||
|
)
|
||
|
(box :class "uvIndex" :orientation orientation
|
||
|
(box :class "icon" "")
|
||
|
"${weather.current_condition[0].uvIndex}")
|
||
|
(box :class "humidity" :orientation orientation
|
||
|
(box :class "icon" "")
|
||
|
"${weather.current_condition[0].humidity}"
|
||
|
)
|
||
|
(box :class "precip" :orientation orientation
|
||
|
(box :class "icon" "")
|
||
|
"${weather.current_condition[0].precipMM}"
|
||
|
)
|
||
|
(box :class "wind" :orientation orientation
|
||
|
(box :class "icon" "")
|
||
|
"${weather.current_condition[0].windspeedKmph}"
|
||
|
"${weather.current_condition[0].winddir16Point}"
|
||
|
)
|
||
|
(box :class "cloud" :orientation orientation
|
||
|
(box :class "icon" "")
|
||
|
"${weather.current_condition[0].cloudcover}"
|
||
|
)
|
||
|
))
|
||
|
|
||
|
(defpoll moon :initial "" :interval "180s"
|
||
|
"curl wttr.in/?format=%m")
|
||
|
(defpoll weather :initial "{\"current_condition\": [{\"cloudcover\": \"\"}]}" :interval "180s"
|
||
|
"curl wttr.in/?format=j1")
|
||
|
|
||
|
(defwidget widget_workspaces []
|
||
|
(box
|
||
|
:class "workspaces"
|
||
|
:orientation "v"
|
||
|
:space-evenly true
|
||
|
:valign "start" :spacing 10
|
||
|
:halign "center"
|
||
|
(for workspace in workspaces
|
||
|
(button
|
||
|
:class "${workspace.class}"
|
||
|
:onclick "scripts/workspace.sh ${workspace.id}"
|
||
|
"${workspace.text}"))
|
||
|
))
|
||
|
(deflisten workspaces :initial "[]"
|
||
|
"scripts/get-workspaces")
|
||
|
|
||
|
|
||
|
(defwidget widget_clock []
|
||
|
(box
|
||
|
:class "clock"
|
||
|
:orientation "v"
|
||
|
:valign "end"
|
||
|
:spacing 1
|
||
|
(box :class "icon" "")
|
||
|
"${clock.H}" "${clock.M}"
|
||
|
(box :class "icon" "")
|
||
|
"${clock.m}" "${clock.d}"
|
||
|
))
|
||
|
|
||
|
(defpoll clock :initial "{}" :interval "10s"
|
||
|
"date '+{\"H\":\"%H\", \"M\":\"%M\", \"d\":\"%d\", \"m\":\"%m\", \"b\":\"%b\", \"Y\":\"%Y\"}'")
|
||
|
|
||
|
|
||
|
|
||
|
; Calendar
|
||
|
|
||
|
(defwindow calendar
|
||
|
:geometry (geometry :x "70px"
|
||
|
:y "65%"
|
||
|
:width "270px"
|
||
|
:height "60px")
|
||
|
(cal))
|
||
|
|
||
|
|
||
|
(defwidget cal []
|
||
|
(box :class "cal"
|
||
|
:orientation "v"
|
||
|
(box :class "cal-inner-box"
|
||
|
(calendar :class "cal"
|
||
|
:day calendar_day
|
||
|
:month calendar_month
|
||
|
:year calendar_year))))
|
||
|
(defpoll calendar_day :interval "10h"
|
||
|
"date '+%d'")
|
||
|
(defpoll calendar_month :interval "10h"
|
||
|
"scripts/calendar")
|
||
|
(defpoll calendar_year :interval "10h"
|
||
|
"date '+%Y'")
|
||
|
|
||
|
; Unused widgets
|
||
|
|
||
|
(defwidget widget_status []
|
||
|
(box
|
||
|
:class "status"
|
||
|
:orientation "v"
|
||
|
:space-evenly false
|
||
|
:valign "end"
|
||
|
(metric :label ""
|
||
|
:value volume
|
||
|
:onchange "amixer -D pulse sset Master {}%")
|
||
|
(metric :label ""
|
||
|
:value {EWW_RAM.used_mem_perc}
|
||
|
:onchange "")
|
||
|
(widget_clock)))
|
||
|
|
||
|
|
||
|
(defwidget widget_media []
|
||
|
(box :class "media"
|
||
|
:orientation "v"
|
||
|
:space-evenly false
|
||
|
:valign "center"
|
||
|
{music_listener != "" ? "『${music_listener}』" : ""}
|
||
|
(box :class "music_status"
|
||
|
:orientation "h"
|
||
|
:space-evenly false
|
||
|
:halign "center"
|
||
|
{music_listener != "" ? "${music_status_listener}" : ""})
|
||
|
))
|
||
|
|
||
|
(deflisten music_listener :initial ""
|
||
|
"playerctl --follow metadata --format '{{ artist }} / {{album}} / {{ title }}' || true")
|
||
|
(deflisten music_status_listener :initial ""
|
||
|
"playerctl --follow metadata --format '{{duration(position)}}/{{duration(mpris:length)}}' || true")
|
||
|
|
||
|
|
||
|
(defwidget metric [label value onchange]
|
||
|
(box
|
||
|
:orientation "v"
|
||
|
:class "metric"
|
||
|
:space-evenly false
|
||
|
(box :class "label" label)
|
||
|
(circular-progress :value value)
|
||
|
;(scale
|
||
|
; :min 0 :max 101
|
||
|
; :active {onchange != ""}
|
||
|
; :orientation "v"
|
||
|
; :value value
|
||
|
; :onchange onchange)
|
||
|
))
|
||
|
|
||
|
(defpoll volume :initial 0 :interval "1s"
|
||
|
"scripts/get-volume.sh")
|