; Brightness (defpoll brightness :initial "128" :interval "1h" "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 (deflisten network :initial '{"if": "null"}' "~/.config/eww/scripts/get-network.sh") ; Notifications status (defpoll nf-enabled :initial "true" :interval "1h" "makoctl mode | grep -q dnd && echo false || echo true") ; Packages updates (deflisten packages-updates :initial '{"count": "-", "class": " "}' "~/.config/eww/scripts/pkg-updates.sh") ; Volume (defpoll volume :initial '{"input":{"value":50,"muted":0},"output":{"value":50,"muted":0}}' :interval "1h" "~/.config/eww/scripts/get-volume.sh") (defvar volume-icons '{"input": {"active": ["󰍬", "󰍬", "󰍬"], "muted": "󰍭"}, "output": {"active": ["󰕿", "󰖀", "󰕾"], "muted": "󰝟"}}') (defvar volume-slide '{"input": false, "output": false}') ; 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" :spacing 12 :space-evenly false (workspaces) (tray) (nf-state) (packages-updates) (volume) (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.id}" :class "workspace ${workspace.id == active-workspace ? "active" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}" (label :text "${workspace.id == active-workspace ? "" :""}") ) ) ) ) ) (defwidget tray [] (systray :spacing 8 :icon-size 16 :class "systray" ) ) (defwidget nf-state [] (eventbox :onclick "~/.config/eww/scripts/toggle-nf-state.sh" (label :text "${nf-enabled ? "󰂚" : "󰂛"} NF" :class "${nf-enabled ? "" : "disabled"}" ) ) ) (defwidget packages-updates [] (eventbox :onclick "pkill -SIGUSR1 -u $(id -u) pkg-updates.sh" (label :text "󰏖 ${packages-updates.count}" :class "${packages-updates.class}" :tooltip "${packages-updates.tooltip}" ) ) ) (defwidget volume [] (box :spacing 10 :space-evenly false (for target in '["output", "input"]' (eventbox :onhover "${EWW_CMD} update volume-slide=$(${EWW_CMD} get volume-slide | jq -c '.${target} = true')" :onhoverlost "${EWW_CMD} update volume-slide=$(${EWW_CMD} get volume-slide | jq -c '.${target} = false')" (box :space-evenly false :class "${volume[target].muted == 1 ? "disabled" : ""}" (eventbox :onclick "~/.config/eww/scripts/toggle-volume-mute.sh ${target}" (label :text "${volume[target].muted == 1 ? "${volume-icons[target].muted}" : "${volume-icons[target].active[round(volume[target].value / 42, 0)]}"} ${volume[target].value}%") ) (revealer :transition "slideleft" :reveal {volume-slide[target]} (scale :value {volume[target].value} :min 0 :max 101 :onchange "~/.config/eww/scripts/set-volume.sh ${target} {}" ) ) ) ) ) ) ) (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" ? "" : "󰜮 ${network.down} 󰜷 ${network.up}"}") ) ) (defwidget bar-middle [] (label :limit-width 42 :show-truncated false :text "${window-title}" ) ) (defwidget bar-right [] (box :halign "end" :spacing 12 :space-evenly false (brightness) (battery :percent {EWW_BATTERY.BAT0.capacity} :status {EWW_BATTERY.BAT0.status} ) (ram) (cpu-temp) (cpu-usage) (clock) ) ) (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 256 :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 "󰸁" ) ) (defwidget cpu-usage [] (label :text " ${round(EWW_CPU.avg, 0)}%" :tooltip " ${arraylength(EWW_CPU.cores)} cores available" ) ) (defwidget clock [] (tooltip (calendar :day {day} :month {month} :year {year} ) (label :text "󰥔 ${datetime}") ) ) ; Bar (defwidget bar [] (box (bar-left) (bar-middle) (bar-right) ) ) (defwindow bar :monitor 0 :geometry (geometry :x "0%" :y "0%" :width "100%" :height "30px" :anchor "top center" ) :stacking "fg" :exclusive true (bar) )