(defwidget bar [] (centerbox :orientation "h" (sidestuff) (box) (music))) (defwindow bar0 :monitor 0 :stacking "fg" :exclusive true :geometry (geometry :x "0%" :y "0%" :width "100%" :height "32px" :anchor "bottom center") (bar)) (defwindow bar1 :monitor 1 :stacking "fg" :exclusive true :geometry (geometry :x "0%" :y "0%" :width "100%" :height "32px" :anchor "bottom center") (bar)) (defwidget sidestuff [] (box :class "sidestuff" :orientation "h" :space-evenly false :halign "start" :spacing 20 time ; TODO: indicator/tray/taskbar/toolbar icons and management? (probably should use something standalone?) ; https://github.com/elkowar/eww/issues/111 ; TODO: idle inhibitor? ; TODO: battery time remaining? ; TODO: hyprland workspaces? ; TODO: get these to align properly? icons seem lower than they should be? (box :class "mic" ( box :class {micMuted == "false" ? "live" : "muted"} {micMuted == "false" ? " " : " "} ) {micVolume + "%"} ) (box :class "vol" ( box :class {muted == "false" ? "live" : "muted"} {muted == "false" ? "󰕾 " : "󰖁 "} ) {volume + "%"} ) {" " + round(EWW_CPU["avg"], 0) + "%"} {" " + round(EWW_RAM["used_mem_perc"], 0) + "%"} {showBrightness == "true" ? "" : " " + brightness + "%"} {showBattery == "true" ? "" : "󱊣 " + EWW_BATTERY["BAT1"]["capacity"] + "%"} )) (defwidget music [] (box :class "music" :orientation "h" :halign "end" :space-evenly false {music != "" ? "${music}" : ""})) (deflisten music :initial "" "playerctl --follow metadata --format '{{ title }} by {{ artist }}' || true") (deflisten volume :initial "0" "pamixer --get-volume; pactl subscribe | grep sink --line-buffered | while read i; do pamixer --get-volume; done") (deflisten muted :initial "false" "pamixer --get-mute; pactl subscribe | grep sink --line-buffered | while read i; do pamixer --get-mute; done") (deflisten micVolume :initial "0" "pamixer --default-source --get-volume; pactl subscribe | grep source --line-buffered | while read i; do pamixer --default-source --get-volume; done") (deflisten micMuted :initial "false" "pamixer --default-source --get-mute; pactl subscribe | grep source --line-buffered | while read i; do pamixer --default-source --get-mute; done") (defpoll time :interval "1s" "date '+%a %b %d %H:%M:%S'") (defpoll showBrightness :interval "24h" ; if we have at least one file in /sys/class/backlight, we should try and show brightness "if [ \"$(find /sys/class/backlight -mindepth 1 -maxdepth 1 | head -n 1 | wc -l)\" == \"1\" ]; then echo true; else echo false; fi") (defpoll showBattery :interval "24h" ; if we have at least one battery in /sys/class/power_supply, we should try and show battery levels "if [ \"$(find /sys/class/power_supply* -mindepth 1 -maxdepth 1 | grep '^BAT' | head -n 1 | wc -l)\" == \"1\" ]; then echo true; else echo false; fi") (defpoll brightness :interval "10s" "echo $(((100 * $(brightnessctl get)) / $(brightnessctl max)))") (defpoll monitor :interval "60s" "echo $EWW_BAR_MON")