(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 "100%" :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) ;(widget-weather :orientation "v") (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" (circular-progress :class "media" :width 20 :height 20 :thickness 5 ;:tooltip {music_listener_position} :tooltip "${music_position} / ${music_length}" :value {100.0 * music_position / (music_length / 1000000.0)} :visible {music_listener != "" && music_length != 1} ) ; Add play and pause buttons here? (label :angle 270 :xalign 0.5 :yalign 0.5 :justify "center" :text {music_listener != "" ? "『${music_listener}』" : "『』"}) )) (deflisten music_listener :initial "" "playerctl --follow metadata --format '{{ artist }} / {{album}} / {{ title }}' || true") (deflisten music_listener_position :initial "" "playerctl --follow metadata --format '{{duration(position)}} / {{duration(mpris:length)}}' || true") (defpoll music_position :interval "1s" "playerctl position") (deflisten music_length :initial 1 "playerctl --follow metadata mpris:length") (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 {}%" )) (button :class "audio" :onclick "scripts/popup audio" :tooltip "Volume: ${current-volume}%" :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 [] (box :class "clock" :orientation "v" :valign "end" :spacing 1 :width 25 (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'") ; 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 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")