; Brightness (defpoll brightness :initial "128" :interval "1m" "cat /sys/class/backlight/amdgpu_bl1/brightness") (defvar brightness-icons '["", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]') (defvar brightness-slide false) ; Battery (defvar battery-icons '{"Full": {"10": "󰂄"}, "Charging": ["󰢟", "󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"], "Discharging": ["󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"]}') ; DateTime (defpoll datetime :interval "1s" "date +'%a %e %b %X'") (defpoll month :interval "1m" :initial "1" "date +'%m'") (defpoll day :interval "1m" :initial "1" "date +'%d'") (defpoll year :interval "1m" :initial "0" "date +'%Y'") ; Network (defpoll network :initial '{"if": "lo"}' :interval "2s" "~/.config/eww/scripts/get-network.sh") ; Notifications status (defpoll nf-enabled :initial "true" :interval "1m" "makoctl mode | grep -q dnd && echo false || echo true") ; Packages updates (deflisten packages-updates :initial '{"count": "-", "class": " "}' "~/.config/eww/scripts/pkg-updates.sh") ; Window Title (deflisten window-title "~/.config/eww/scripts/get-window-title.sh") ; Workspaces (deflisten workspaces :initial "[]" "~/.config/eww/scripts/get-workspaces.sh") (deflisten active-workspace "~/.config/eww/scripts/get-active-workspace.sh") ; Widgets (defwidget bar-left [] (box :halign "start" :space-evenly false (workspaces) (systray :spacing 8 :icon-size 16 :class "systray" ) (nf-state) (packages-updates) (network) ) ) (defwidget workspaces [] (eventbox :onscroll "~/.config/eww/scripts/change-active-workspace.sh {} ${active-workspace}" (box :spacing 0 (for workspace in workspaces (eventbox :onclick "hyprctl dispatch workspace ${workspace}" :class "workspace ${workspace == active-workspace ? "active" : ""}" (label :text "${workspace}") ) ) ) ) ) (defwidget nf-state [] (eventbox :onclick "~/.config/eww/scripts/toggle-nf-state.sh" (label :text "${nf-enabled ? "󰂚" : "󰂛"} NF" :class "${nf-enabled ? "" : "disabled"}" ) ) ) (defwidget packages-updates [] (label :text "󰏖 ${packages-updates.count}" :class "${packages-updates.class}" :tooltip "${packages-updates.tooltip}" ) ) (defwidget network [] (tooltip (label :text "IPv4: ${network.ip4}\\nIPv6: ${network.ip6}${network.type == "wifi" ? "\\nRate: ${network.rate}\\nSignal strength: ${network.signal}" : ""}") (label :text "${network.icon} ${network.name} ${network.if == "null" ? "" : "󰜮 ${EWW_NET[network.if].NET_DOWN} 󰜷 ${EWW_NET[network.if].NET_UP}"}") ) ) (defwidget bar-middle [] (label :limit-width 2 :text "${window-title}" ) ) (defwidget bar-right [] (box :halign "end" :space-evenly false (brightness) (battery :percent {EWW_BATTERY.BAT0.capacity} :status {EWW_BATTERY.BAT0.status} ) (ram) (cpu-temp) (label :text " ${round(EWW_CPU.avg, 0)}%" :tooltip " ${arraylength(EWW_CPU.cores)} cores available" ) (tooltip (calendar :day {day} :month {month} :year {year} ) (label :text "󰥔 ${datetime}") ) ) ) (defwidget brightness [] (eventbox :onhover "${EWW_CMD} update brightness-slide=true" :onhoverlost "${EWW_CMD} update brightness-slide=false" (box :space-evenly false (label :text "${brightness-icons[round(brightness / 18.2, 0)]} ${round(brightness /255 * 100, 0)}%") (revealer :transition "slideleft" :reveal {brightness-slide} (scale :value {brightness} :min 0 :max 255 :onchange "~/.config/eww/scripts/set-brightness.sh {}" ) ) ) ) ) (defwidget battery [percent status] (label :text "${battery-icons[status][round(percent / 10, 0)]} ${percent}%" :tooltip "${percent}% (${status})" :class "${percent <= 30 ? percent <= 15 ? 'crit' : 'alert' : ''}" ) ) (defwidget ram [] (label :text " ${round(EWW_RAM.used_mem / 1073741824, 2)}GiB" :tooltip " ${round(EWW_RAM.used_mem / 1073741824, 2)}GiB out of ${round(EWW_RAM.total_mem / 1073741824, 2)}GiB used" ) ) (defwidget threshold [val unit alert-val crit-val icon alert-icon crit-icon] (label :text "${val < alert-val ? icon : (val < crit-val ? alert-icon : crit-icon)} ${round(val, 0)}${unit}" :class "${val < alert-val ? '' : (val < crit-val ? 'alert' : 'crit')}" ) ) (defwidget cpu-temp [] (threshold :val {EWW_TEMPS.K10TEMP_TCTL} :unit "°C" :alert-val 65 :crit-val 75 :icon "󱃃" :alert-icon "󰔏" :crit-icon "󰸁" ) ) ; Bar (defwidget bar [] (box (bar-left) (bar-middle) (bar-right) ) ) (defwindow bar :monitor 0 :geometry (geometry :x "0%" :y "0%" :width "100%" :anchor "top center" ) :stacking "fg" :exclusive true (bar) )