(defwidget menu []
  (button
    :onclick "eww open menu-window"
    (label
      :text "⏻"
    :class "menu-widget")))


(defwidget menubox []
  (box
    :orientation "v"
    :space-evenly true
    :class "menubox"
    :spacing 0
    (box :class "menubox-header"
      :orientation "h"
      (label :halign "start" :text "${fulldate}"))
    (box :class "info-box"
      :orientation "h"
      (circular-progress
        :class "cpu"
        :start-at 0
        :thickness 6
        :clockwise true
        :value {EWW_CPU.avg}
        (label
          :style "font-size: 24px; margin-right: 0.1rem;"
        :text "󰍛"))
      (circular-progress
        :class "mem"
        :start-at 0
        :thickness 6
        :clockwise true
        :value {EWW_RAM.used_mem_perc}
        (label
          :style "font-size: 24px; margin-right: 0.8rem;"
        :text ""))
      (circular-progress
        :class "storage"
        :start-at 0
        :thickness 6
        :clockwise true
        :value {EWW_RAM.used_mem_perc}
        (label
          :style "font-size: 24px;"
        :text ""))
      (label
      :text "  ${uptime}")
    )
    (box :class "menubox-widgets"
      :orientation "h"
      (button :class "menubox-widgets text" :onclick "reboot" "")
      (button :class "menubox-widgets text" :onclick "shutdown now" "")
      (button :class "menubox-widgets text" :onclick "eww close menu-window" "")))
)

(defwindow menu-window
  :monitor 0
  :windowtype "dock"
  :geometry (geometry
    :x "0.9%"
    :y "1.5%"
    :width "25%"
    :height "600px"
  :anchor "top right")
  :stacking "fg"
  :windowtype "dock"
  :wm-ignore true
  :exclusive false
  (menubox))
