;; ── Bar ───────────────────────────────────────────────────────────── (defwindow bar [] :geometry (geometry :x "0px" :y "0px" :width "100%" :height "25px" :anchor "top center" ) :reserve (struts :distance "25px" :side "top") :exclusive true :layer "top" :windowtype "dock" (box :orientation "horizontal" :space-evenly false :class "bar" (widgetWorkspaces) (widgetLogSeperator) (widgetLayouts) (widgetLogSeperator) (widgetWindows) (box :hexpand true) (idle_inhibitor) (widSep) (WidgetAudio) (widSep) (widgetBacklight) (widSep) (widgetCpu) (widSep) (widgetMemory) (widSep) (widgetBattery) (widSep) (widgetNetwork) (widSep) (widgetTime) ) ) ;; ── Widget Separator ──────────────────────────────────────────────── (defwidget widSep [] (label :class "text separator" :text "|")) ;; ── Idle Inhibitor ────────────────────────────────────────────────── (deflisten idle_inhibitor "journalctl --output=cat --output-fields=JOB_TYPE --user --follow --unit=hypridle.service") (defwidget idle_inhibitor [] (box :space-evenly false (button :class "${idle_inhibitor == 'stop' ? 'idleOff' : 'idleOn' }" :onclick "systemctl --user is-active hypridle.service && systemctl --user stop hypridle.service || systemctl --user start hypridle.service" (label :text "${idle_inhibitor == 'stop' ? '󰛐' : '󰈈' }")))) ;; ── Audio ─────────────────────────────────────────────────────────── (defvar micClass "micOff") (defvar micIcon "󰍭") (defvar speakerClass "speakerOff") (defvar speakerIcon "") (defpoll speakerVolume :interval "1s" :initial "0" `sh ~/.config/eww/scripts/audio.sh`) (defwidget WidgetAudio [] (box :space-evenly false (label :class speakerClass :text "${speakerIcon} ") (label :class "text" :text "${speakerVolume}% ") (label :class micClass :text "${micIcon}"))) ;; ── Backlight ─────────────────────────────────────────────────────── (defpoll backlight :interval "1s" :initial "0" `xbacklight -get`) (defwidget widgetBacklight [] (box :space-evenly false (label :class "backlight" :text " ") (label :class "text" :text "${backlight}%"))) ;; ── CPU ───────────────────────────────────────────────────────────── (defpoll cpu :interval "1s" :initial "0" `sh ~/.config/eww/scripts/cpu.sh`) (defwidget widgetCpu [] (box :space-evenly false (label :class "cpu" :text " ") (label :class "text" :text "${cpu}%"))) ;; ── Memory ────────────────────────────────────────────────────────── (defpoll memory :interval "1s" :initial "0" `sh ~/.config/eww/scripts/memory.sh`) (defwidget widgetMemory [] (box :space-evenly false (label :class "memory" :text " ") (label :class "text" :text "${memory}%"))) ;; ── Battery ───────────────────────────────────────────────────────── (defvar batteryClass "speakerOff") (defvar batteryIcon "") (defpoll batteryVolume :interval "1s" :initial "0" `sh ~/.config/eww/scripts/battery.sh`) (defwidget widgetBattery [] (box :space-evenly false (label :class batteryClass :text "${batteryIcon} ") (label :class "text" :text "${batteryVolume}%"))) ;; ── Network ───────────────────────────────────────────────────────── (defvar networkDown "0") (defpoll networkUp :interval "1s" :initial "0" `sh ~/.config/eww/scripts/network.sh`) (defwidget widgetNetwork [] (box :space-evenly false (label :class "networkDown" :text " ") (label :class "text" :text "${networkDown} ") (label :class "networkUp" :text " ") (label :class "text" :text "${networkUp}"))) ;; ── Time ──────────────────────────────────────────────────────────── (defpoll date :interval "1s" :initial "-" `date '+ %a %d.%m.%y %H:%M'`) (defwidget widgetTime [] (box :space-evenly false (label :class "time" :text " ") (label :class "text" :text "${date}"))) ;; ── River State ───────────────────────────────────────────────────── (deflisten river_tag :initial "" `ristate -t | jq -r '.tags.Unknown[0] // empty'`) (deflisten river_title :initial "-" `ristate -w | jq -r '.title // "-"'`) (deflisten river_layout :initial "-" `ristate -l | jq -r '.layout // "-"'`) (defvar ws2 "ws-empty") (defvar ws3 "ws-empty") (defvar ws4 "ws-empty") (defvar ws5 "ws-empty") (defvar ws6 "ws-empty") (defvar ws7 "ws-empty") (defvar ws8 "ws-empty") (defvar ws9 "ws-empty") (defvar layouts "") (defpoll windows :interval "1s" :initial "-" `sh ~/.config/eww/scripts/ristate_read.sh`) (defwidget widgetWorkspaces [] (box :orientation "horizontal" :class "workspace-buttons" (button :onclick "riverctl set-focused-tags 1" :class "workspace-button ${river_tag == \"1\" ? \"ws-current\" : \"ws-empty\"}" (label :text "1")) (label :text " ") (button :onclick "riverctl set-focused-tags 2" :class "workspace-button ${ws2}" (label :text "2")) (label :text " ") (button :onclick "riverctl set-focused-tags 3" :class "workspace-button ${ws3}" (label :text "3")) (label :text " ") (button :onclick "riverctl set-focused-tags 4" :class "workspace-button ${ws4}" (label :text "4")) (label :text " ") (button :onclick "riverctl set-focused-tags 5" :class "workspace-button ${ws5}" (label :text "5")) (label :text " ") (button :onclick "riverctl set-focused-tags 6" :class "workspace-button ${ws6}" (label :text "6")) (label :text " ") ;; (button :onclick "riverctl set-focused-tags 7" :class "workspace-button ${river_tag == \"7\" ? \"ws-current\" : \"ws-empty\"}" (label :text "s")) (label :text " ") (button :onclick "riverctl set-focused-tags 8" :class "workspace-button ${ws8}" (label :text "8")) (label :text " ") (button :onclick "riverctl set-focused-tags 9" :class "workspace-button ${ws9}" (label :text "9")) )) (defwidget widgetWindows [] (label :text "${river_title}")) (defwidget widgetLayouts [] (label :text "${river_layout}")) (defwidget widgetLogSeperator [] (label :class "text separator" :text "⦁"))