(deflisten batterystatus :initial "unknown" "listen/battery BAT0" ) (deflisten workspaces :initial '{"current":1,"used":[1]}' "listen/hypr workspace" ) (deflisten windowtitle :initial '' "listen/hypr activewindow" ) (deflisten submap :initial '' "listen/hypr submap" ) (deflisten network :initial '{"state":"disconnect"}' "listen/network" ) (deflisten notifications :initial '{"count":0}' "swaync-client --subscribe" ) (deflisten sound :initial '{"output-volume":0,"input-volume":0,"output-muted":false}' "listen/sound" ) (defvar battery-icon '{ "unknown": "", "critical": "", "low": "", "medium": "", "high": "", "full": "" }') (defvar network-icon '{ "disconnected": "󰲛", "ethernet": "󰈀", "wifi-terrible": "󰤯", "wifi-bad": "󰤟", "wifi-mediocre": "󰤢", "wifi-good": "󰤥", "wifi-excellent": "󰤨", "tethering": "󰕓" }') (defvar notifications-icon '{ "nothing": "󰂚", "new": "󱅫", "dnd": "󰂛" }') (defvar sound-icon '{ "absent": "󰕿", "moderate": "󰖀", "loud": "󰕾", "muted": "󰝟" }') (defwidget workspaces [] (eventbox :onscroll 'action/hyprland/nearby-workspace "{}"' (box :class "workspaces" (for workspace in {workspaces.used} (eventbox :class "workspace-button ${workspace == workspaces.current ? "workspace-current" : ""}" :onclick 'hyprctl dispatch workspace "${workspace}"' (box :width 25 "${workspace}") ) ) ) ) ) (defwidget submap [] (eventbox :onclick "hyprctl dispatch submap reset" (box :class "submap" "${submap}") ) ) (defwidget window-title [] (box "${windowtitle ?: ''}") ) (defwidget tray [] (box (systray :icon-size 15 :spacing 10 ))) (defwidget time [] (box (eventbox :onclick 'eww open --toggle calendar' "${formattime(EWW_TIME, "%Y-%m-%d")} ${formattime(EWW_TIME, "%H:%M:%S")}" )) ) (defwidget notifications [] (box (eventbox :class "module" :onclick 'swaync-client --toggle-panel' :onrightclick 'swaync-client --toggle-dnd' :onmiddleclick 'swaync-client --close-all' "${ notifications.dnd == true ? notifications-icon["dnd"] : notifications.count > 0 ? notifications-icon["new"] : notifications-icon["nothing"] } ${notifications.count}" )) ) (defwidget sound [] (box (eventbox :onscroll 'action/volume "{}"' :onclick 'hyprctl dispatch exec pavucontrol' :onrightclick 'pamixer --toggle-mute' "${ sound.output-muted == true ? sound-icon["muted"] : sound.output-volume < 33 ? sound-icon["absent"] : sound.output-volume < 67 ? sound-icon["moderate"] : sound-icon["loud"] } ${sound.output-volume} % ${sound.sink-name}" )) ) (defwidget network [] "${ network.state == "wireless" ? network-icon["wifi-${network.wifi.signal}"] : network-icon[network.state] } ${ network.state == "disconnected" ? "No network" : network.state == "ethernet" ? "Ethernet" : network.state == "wireless" ? network.wifi.ssid : network.state == "tethering" ? "USB tethering" : '' }" ) (defwidget battery [] "${battery-icon[batterystatus]}${EWW_BATTERY.BAT0.status == "Charging" ? " " : ""} ${EWW_BATTERY.BAT0.capacity} %" ) (defwindow bar :monitor 0 :geometry (geometry :anchor "bottom center" :width "100%" :height 25 ) :exclusive true (centerbox (box :halign "start" :space-evenly false :class "left" (workspaces) (submap) (window-title) ) (box :space-evenly false :class "middle" (tray) (time) (notifications) ) (box :halign "end" :space-evenly false :class "right" (sound) (network) (battery) ) ) ) (defwindow calendar :monitor 0 :geometry (geometry :anchor "bottom center" :width "350px" :height "200px" ) :exclusive false ; :stacking "fg" (calendar) )