2023-08-28 15:31:02 -07:00
|
|
|
(defvar eww "eww --config $HOME/.config/eww/bar")
|
|
|
|
|
2024-05-31 14:33:53 -07:00
|
|
|
(defwindow vbar
|
2023-08-28 15:31:02 -07:00
|
|
|
: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")
|
2024-05-31 14:33:53 -07:00
|
|
|
(centerbox
|
|
|
|
:orientation "v"
|
2023-08-28 15:31:02 -07:00
|
|
|
(box :orientation "v" :space-evenly false :valign "start"
|
2024-05-31 14:33:53 -07:00
|
|
|
(box :class "launcher" :valign "start" :width "10px" :height "10px" "☯")
|
|
|
|
;(label :class "launcher" :valign "start" :width "20px" :height "20px" :unindent true
|
|
|
|
; :text "☯")
|
|
|
|
(widget-workspaces)
|
|
|
|
)
|
|
|
|
(widget-media)
|
|
|
|
;(widget-weather :orientation "v")
|
|
|
|
(box :orientation "v" :space-evenly false :valign "end"
|
|
|
|
(widget-tray)
|
|
|
|
(widget-audio)
|
|
|
|
(widget-cpu)
|
|
|
|
(widget-memory)
|
|
|
|
(widget-clock)
|
2023-08-28 15:31:02 -07:00
|
|
|
)
|
|
|
|
;(widget_status)
|
|
|
|
))
|
2024-05-31 14:33:53 -07:00
|
|
|
(defwindow hbar
|
|
|
|
:exclusive true
|
|
|
|
:monitor 0
|
|
|
|
:windowtype "dock"
|
|
|
|
:geometry (geometry
|
|
|
|
:x "0%"
|
|
|
|
:y "0%"
|
|
|
|
:width "90%"
|
|
|
|
:height "20px"
|
|
|
|
:anchor "top center"
|
|
|
|
)
|
|
|
|
:reserve (struts :side "top" :distance "20px")
|
|
|
|
(centerbox :orientation "h"
|
|
|
|
(box :orientation "h")
|
|
|
|
(box :orientation "h")
|
|
|
|
(box :orientation "h" :space-evenly false :halign "end"
|
|
|
|
(widget-cpu)
|
|
|
|
(widget-memory)
|
|
|
|
)
|
|
|
|
))
|
2023-08-28 15:31:02 -07:00
|
|
|
|
2024-05-31 14:33:53 -07:00
|
|
|
(defwidget widget-workspaces []
|
2023-08-28 15:31:02 -07:00
|
|
|
(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
|
|
|
|
|
2024-05-31 14:33:53 -07:00
|
|
|
(defwidget widget-weather [orientation]
|
2023-08-28 15:31:02 -07:00
|
|
|
(box
|
|
|
|
:class "weather"
|
|
|
|
:orientation orientation
|
|
|
|
:space-evenly false
|
|
|
|
:valign "start"
|
|
|
|
:halign "center"
|
|
|
|
:spacing 10
|
|
|
|
(button :onclick "scripts/popup weather" "W")
|
|
|
|
))
|
|
|
|
|
2024-05-31 14:33:53 -07:00
|
|
|
(defpoll weather-text :initial "" :interval "180s"
|
2023-08-28 15:31:02 -07:00
|
|
|
"curl --max-time 2 wttr.in")
|
|
|
|
|
|
|
|
(defwindow weather
|
|
|
|
:geometry (geometry :x "70px"
|
|
|
|
:y "50%"
|
|
|
|
:width "270px"
|
|
|
|
:height "60px")
|
2024-05-31 14:33:53 -07:00
|
|
|
(box weather-text))
|
2023-08-28 15:31:02 -07:00
|
|
|
|
|
|
|
|
2024-05-31 14:33:53 -07:00
|
|
|
(defwidget widget-media []
|
|
|
|
(box
|
|
|
|
:class "media"
|
|
|
|
:orientation "v"
|
|
|
|
:space-evenly false
|
|
|
|
:valign "center"
|
|
|
|
(circular-progress
|
|
|
|
:class "media"
|
|
|
|
:width 20
|
|
|
|
:height 20
|
|
|
|
:thickness 4
|
|
|
|
:tooltip {music_status_listener}
|
|
|
|
:value {music_position}
|
|
|
|
:visible {music_listener != ""}
|
|
|
|
)
|
|
|
|
(label
|
|
|
|
:angle 90
|
|
|
|
:xalign 0.5
|
|
|
|
:yalign 0.5
|
|
|
|
:text {music_listener != "" ? "『${music_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")
|
|
|
|
(deflisten music_position :initial 0.5
|
|
|
|
"playerctl --follow metadata --format '{{100.0 * position / mpris:length}}' || true")
|
2023-08-28 15:31:02 -07:00
|
|
|
|
2024-05-31 14:33:53 -07:00
|
|
|
(defwidget widget-audio []
|
|
|
|
(scale
|
|
|
|
:class "audio"
|
|
|
|
:orientation "v"
|
|
|
|
:min 0
|
|
|
|
:max 100
|
|
|
|
:value 23
|
|
|
|
))
|
|
|
|
(defwidget widget-audio []
|
|
|
|
(eventbox
|
|
|
|
:onhover "${eww} update show_audio=true"
|
|
|
|
:onhoverlost "${eww} update show_audio=false"
|
|
|
|
(box
|
|
|
|
:class "audio"
|
|
|
|
:orientation "v"
|
|
|
|
:space-evenly "false"
|
|
|
|
:spacing "2"
|
|
|
|
(revealer :transition "slideup" :reveal show_audio
|
|
|
|
(scale
|
|
|
|
:class "audio-scale"
|
|
|
|
:value current-volume
|
|
|
|
:orientation "v"
|
|
|
|
:flipped true
|
|
|
|
:tooltip "Volume: ${current-volume}%"
|
|
|
|
:max 101
|
|
|
|
:min 0
|
|
|
|
:onchange "amixer -D pulse sset Master {}%" ))
|
|
|
|
(button
|
|
|
|
:onclick "scripts/popup audio"
|
|
|
|
:class "volume-icon" ""))))
|
|
|
|
(defpoll current-volume :interval "1s" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'")
|
|
|
|
(defvar show_audio false)
|
|
|
|
|
|
|
|
(defwidget widget-cpu []
|
|
|
|
(circular-progress
|
|
|
|
:class "cpu"
|
|
|
|
:width 20
|
|
|
|
:height 20
|
|
|
|
:thickness 4
|
|
|
|
:tooltip {EWW_CPU.cores}
|
|
|
|
:value {EWW_CPU.avg}
|
|
|
|
))
|
|
|
|
(defwidget widget-memory []
|
|
|
|
(circular-progress
|
|
|
|
:class "memory"
|
|
|
|
:width 20
|
|
|
|
:height 20
|
|
|
|
:thickness 4
|
|
|
|
:tooltip "${EWW_RAM.used_mem} / ${EWW_RAM.total_mem}"
|
|
|
|
:value {EWW_RAM.used_mem_perc}
|
|
|
|
))
|
|
|
|
(defwidget widget-tray []
|
|
|
|
(systray
|
|
|
|
:class "systray"
|
|
|
|
:orientation "v"
|
|
|
|
:space-evenly true
|
|
|
|
:icon-size 20
|
|
|
|
:prepend-new true
|
|
|
|
))
|
|
|
|
|
|
|
|
(defwidget widget-clock []
|
2023-08-28 15:31:02 -07:00
|
|
|
(box
|
|
|
|
:class "clock"
|
|
|
|
:orientation "v"
|
|
|
|
:valign "end"
|
|
|
|
:spacing 1
|
2024-05-31 14:33:53 -07:00
|
|
|
:width 25
|
2023-08-28 15:31:02 -07:00
|
|
|
(box :class "icon" "")
|
|
|
|
"${clock.m}" "${clock.d}"
|
2024-05-31 14:33:53 -07:00
|
|
|
(box :class "icon" "")
|
|
|
|
"${clock.H}" "${clock.M}"
|
2023-08-28 15:31:02 -07:00
|
|
|
))
|
|
|
|
|
|
|
|
(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")
|
2024-05-31 14:33:53 -07:00
|
|
|
(cal))
|
2023-08-28 15:31:02 -07:00
|
|
|
|
|
|
|
|
|
|
|
(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
|
|
|
|
|
2024-05-31 14:33:53 -07:00
|
|
|
;(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)))
|
2023-08-28 15:31:02 -07:00
|
|
|
|
|
|
|
|
|
|
|
(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")
|