;; Listeners (deflisten active-workspace `stdbuf -oL scripts/active-workspace-listener`) (deflisten workspace-list :initial '[1]' `stdbuf -oL scripts/workspace-list-listener`) (deflisten datetime `stdbuf -oL scripts/datetime-listener`) (deflisten brightness `stdbuf -oL scripts/backlight-listener`) (deflisten volume :initial '{"icon":"","percentage":""}' `stdbuf -oL scripts/volume-listener`) (deflisten keymap `stdbuf -oL scripts/keymap-listener`) (deflisten emails `stdbuf -oL scripts/email-listener`) ;; Pollers (defpoll user :interval "69h" `whoami | sed 's/.*/\\u&/'`) (defpoll battery :initial '{"icon":"","percentage":""}' :interval "1s" `scripts/battery`) (defpoll wireless :interval "1s" `scripts/wireless`) ;; Windows (defwindow bar-1 :monitor 0 :stacking "fg" :exclusive true :geometry (geometry :width "100%" :height "40px" :anchor "top center") (bar :monitor 0)) (defwindow bar-2 :monitor 1 :stacking "fg" :exclusive true :geometry (geometry :width "100%" :height "40px" :anchor "top center") (bar :monitor 1)) ;; Widgets (defwidget bar [monitor] (centerbox (start :monitor monitor) (middle) (end))) (defwidget start [monitor] (workspaces :monitor monitor)) (defwidget middle [] (clock)) (defwidget end [] (box :halign "end" :class "end" :space-evenly false (emails) (keymap) (wireless) (brightness) (volume) (battery) (user))) (defwidget workspaces [monitor] (box :class "workspaces" :space-evenly false (for id in workspace-list (button :class {active-workspace[monitor] == id ? "active" : ""} :onclick `hyprctl dispatch workspace ${id}` id)))) (defwidget clock [] datetime) (defwidget wireless [] (pair :icon "" :text wireless)) (defwidget keymap [] (pair :icon "" :text keymap)) (defwidget brightness [] (pair :icon "" :text brightness)) (defwidget volume [] (pair :icon {volume.icon} :text {volume.percentage})) (defwidget battery [] (pair :icon {battery.icon} :text {battery.percentage})) (defwidget emails [] (pair :icon "" :text emails)) (defwidget user [] (pair :icon "" :text user)) (defwidget pair [icon text] (box :width 70 :space-evenly false (label :text icon) (label :text text)))