(defvar eww "eww --config $HOME/.config/eww/bar") (defwindow vbar :exclusive true :monitor 0 :windowtype "dock" :geometry (geometry :x "0%" :y "0%" :width "20px" :height "99%" :anchor "center left" ) :reserve (struts :side "left" :distance "20px") (centerbox :orientation "v" (box :orientation "v" :space-evenly false :valign "start" ;(box :class "launcher" :valign "start" :width "10px" :height "10px" "☯") (label :class "launcher" :valign "start" :width "20px" :height "20px" :unindent true :tooltip active-window-title :text "☯") (widget-workspaces) ) (widget-media) (box :orientation "v" :space-evenly false :valign "end" (widget-tray) (widget-audio) (widget-cpu) (widget-memory) (widget-clock) ) ;(widget_status) )) (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) ) )) (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/compositor-control set-workspace ${workspace.id}" "${workspace.text}")) )) (deflisten workspaces :initial "[]" "scripts/compositor-control workspaces") (deflisten active-window-title :initial "" "scripts/compositor-control active-title") ; 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)) (defwidget widget-media [] (box :class "media" :orientation "v" :space-evenly false :valign "center" (eventbox :onclick "playerctl play-pause" (circular-progress :class { media-status == "Paused" ? "media-paused" : "media-playing" } :width 20 :height 20 :thickness 5 :tooltip {media-position-text} :value {100.0 * media-position / (media-length / 1000000.0)} :visible {media-current != "" && media-length != 1} )) (label :class { media-status == "Paused" ? "media-text-paused" : "media-text-playing" } :angle 270 :xalign 0.5 :yalign 0.5 :justify "center" :text {media-current != "" ? "『${media-current}』" : "『』"}) )) (deflisten media-current :initial "" "playerctl --follow metadata --format '{{ artist }} / {{album}} / {{ title }}' || true") (deflisten media-position-text :initial "" "playerctl --follow metadata --format '{{duration(position)}} / {{duration(mpris:length)}}' || true") (defpoll media-position :interval "1s" "playerctl position") (deflisten media-length :initial 1 "playerctl --follow metadata mpris:length") (deflisten media-status :initial "Stopped" "playerctl --follow status") (defwidget widget-audio [] (eventbox :class "audio" :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 :marks true :tooltip "Volume: ${current-volume}%" :max 101 :min 0 :onchange "amixer -D pulse sset Master {}%" )) (label :class "audio-icon" :width 20 :height 20 :xalign 0.5 :yalign 0.5 :noindent true :tooltip "Volume: ${current-volume}%" :text { current-volume == 0 ? "" : (current-volume > 80 ? "" : "") })))) (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 [] (box :class "clock" :orientation "v" :valign "end" :spacing 1 :width 20 (box :class "icon" "") "${clock.m}" "${clock.d}" (box :class "icon" "") "${clock.H}" "${clock.M}" )) (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'") (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")