(deflisten tags_json :initial `[]` `river-bedload -minified -watch tags`) ; (deflisten wintitle :initial `[{"title":""}]` `river-bedload -minified -watch title`) (defpoll song :initial "" :interval "5s" `rmpc song`) (deflisten cava :initial "" `cava -p ~/.config/eww/cava.ini | python3 ~/.config/eww/cava.py`) (deflisten volume :initial "0" `monitor-volume`) (defpoll ssid :initial "" :interval "10s" `iwctl station wlan0 get-networks | awk -F' ' '/>/{print $3}'`) (deflisten brightness :initial "0" `brightctl -l`) (defpoll bartime :initial "" :interval "1s" `date '+%b %-d %H:%M:%S'`) (defwindow bar [output] :monitor 0 :geometry (geometry :x "0%" :y "8px" :width "1904px" :height "32px" :anchor "top center") :stacking "fg" :exclusive true :focusable false (bar :output output)) (defwidget bar [output] (centerbox :orientation "h" :class "bar" (tags :output output) (music) (status))) (defwidget tags [output] (box :orientation "h" :halign "start" :class "tags" (for tag in "[1, 2, 3, 4, 5, 6, 7, 8, 9]" (button :onclick `riverctl set-focused-tags $(dc -e"2 ${tag} 1- ^p")` :class {jq(tags_json, `.[] | select(.output == "${output}" and .id == ${tag}) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class})))) (defwidget music [] (box :orientation "h" :spacing 4 :space-evenly false :class "music" (label :text "${song.metadata.artist} - ${song.metadata.title}" :class "song" :show-truncated true :limit-width 55) (label :text {cava} :class "cava"))) (defwidget title [] (label :text {wintitle[0].title} :class "title" :show-truncated true :visible {wintitle[0].title != ""} :limit-width 55)) ;(defvar showvol false) (defwidget status [] (box :orientation "h" :halign "end" :class "status" :spacing 8 :space-evenly false ;(revealer-on-hover :var showvol ;:varname "showvol" ;:icon "a" ;:transition "slideleft" ;:class "volume" ;(scale :orientation "h" ;:min 0 ;:max 1 ;:value {volume} ;:onchange `wpctl set-volume @DEFAULT_SINK@ {}`) (label :text "${matches(volume, "MUTED") ? " " : volume == 0 ? "" : volume < 50 ? "" : " "} ${volume}%" :class "volume") (label :text "${ssid == "" ? "󰖪" : "󰖩"} ${ssid}" :class "network") (label :text " ${brightness}%" :class "brightness") (label :text "${`{"Discharging": ["󰁺","󰁻","󰁼","󰁽","󰁾","󰁿","󰂀","󰂁","󰂂","󰁹"], "Charging": ["󰢜","󰂆","󰂇","󰂈","󰢝","󰂉","󰢞","󰂊","󰂋","󰂅"]}`?.[EWW_BATTERY.BAT0.status]?.[round((EWW_BATTERY.BAT0.capacity - 1) / 10, 0)] ?: "󰂄"} ${EWW_BATTERY.BAT0.capacity}%" :class "battery") (label :text " ${bartime}" :class "clock") ;(label :text "󰍜" ;:class "menu"))) (label :text "󰐥" :class "power")))