(defwidget bar [] (centerbox :orientation "h" (workspaces) (music) (status) ) ) (defwidget workspaces [] (box :class "workspaces" :orientation "h" :halign "start" :spacing 10 (button :class {active_workspace == 1 ? "active_workspace" : "inactive"} :onclick "hyprctl dispatch workspace 1" 1 ) (button :class {active_workspace == 2 ? "active_workspace" : "inactive"} :onclick "hyprctl dispatch workspace 2" 2) (button :class {active_workspace == 3 ? "active_workspace" : "inactive"} :onclick "hyprctl dispatch workspace 3" 3) (button :class {active_workspace == 4 ? "active_workspace" : "inactive"} :onclick "hyprctl dispatch workspace 4" 4) (button :class {active_workspace == 5 ? "active_workspace" : "inactive"} :onclick "hyprctl dispatch workspace 5" "") (button :class {active_workspace == 6 ? "active_workspace" : "inactive"} :onclick "hyprctl dispatch workspace 6" "󰭹 ") ) ) (defpoll active_workspace :interval "1s" :initial 1 "hyprctl activeworkspace -j | jq .id" ) (defwidget music [] (eventbox :class "music" :orientation "h" :halign "center" :onclick "playerctl play-pause" {music != "" ? " ${music}" : ""} ) ) (deflisten music :initial "" "playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true" ) (defwidget status [] (box :class "status" :orientation "h" :halign "end" :space-evenly false :spacing 20 (systray :orientation "h" :space-evenly false :spacing 10 ) (eventbox :class "layout" :onclick "./toggle_layout.sh" "${layout}" ) (box :class "wifi" :tooltip wifi "${wifi}" ) (eventbox :class "volume" :timeout "1000ms" :onclick "pavucontrol" :onscroll "./volume_scroll.sh {}" "${volume}%" ) (box :class "battery" :tooltip {EWW_BATTERY.BAT0.status} { "󱐋 ${EWW_BATTERY.BAT0.capacity}%"} ) (box :class "time" :tooltip date {formattime(EWW_TIME, "%H:%M")} ) ) ) (defpoll volume :interval "100ms" "./get_volume.sh" ) (defpoll wifi :interval "5s" :initial "󰤭 ..." "./get_wifi.sh" ) (defpoll layout :interval "1s" :initial "󰌌 EN" "./get_layout.sh" ) (defpoll date :interval "5m" "date +'%A, %d %B %Y'" ) (defwindow bar :monitor 0 :windowtype "dock" :geometry (geometry :x "0%" :y "9px" :width "98%" :height "30px" :anchor "top center" ) :exclusive true (bar) )