config/eww/bar/eww.yuck

171 lines
3.6 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_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")
; Weather
(defwidget widget_weather [orientation]
(box
:class "weather"
:orientation orientation
:space-evenly false
:valign "start"
:halign "center"
:spacing 10
(button :onclick "scripts/popup weather" "W")
))
(defpoll weather_text :initial "" :interval "180s"
"curl --max-time 2 wttr.in")
(defwindow weather
:geometry (geometry :x "70px"
:y "50%"
:width "270px"
:height "60px")
(box weather_text))
(defwindow calendar
:geometry (geometry :x "70px"
:y "65%"
:width "270px"
:height "60px")
(cal))
(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")