; WINDOWS (defwindow primary :monitor 0 :stacking "fg" :exclusive true :geometry (geometry :x "0%" :y "0%" :width "100%" :height "20px" :anchor "top center") (primary_bar)) (defwindow left :monitor 1 :stacking "fg" :exclusive false :geometry (geometry :x "0%" :y "0%" :width "100%" :height "20px" :anchor "top center") (left_bar)) (defwindow right :monitor 2 :stacking "fg" :exclusive false :geometry (geometry :x "0%" :y "0%" :width "100%" :height "20px" :anchor "top center") (right_bar)) ; VARIABLES (defpoll battery :interval "1s" "scripts/battery-level") (deflisten workspaces :initial "{}" "bash ~/.config/eww/scripts/get-workspaces") (deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get-active-workspace") (deflisten current_monitor :initial "DP-1" "bash ~/.config/eww/scripts/get-active-monitor") (deflisten window :initial "..." "sh ~/.config/eww/scripts/get-window-title") (deflisten volume :initial "{}" "sh ~/.config/eww/scripts/volume") (defpoll time :interval "10s" "date '+%H:%M'") (defpoll date :interval "10s" "date '+%Y-%m-%d'") ; BARS (defwidget primary_bar [] (box :class "bar primary-bar ${current_monitor == 'DP-1' ? 'active' : ''}" (box :class "primary-left" :space-evenly false :halign "start" (datetime) (workspaces :ids "[\"1\",\"2\",\"3\",\"4\",\"5\"]")) (label :halign "center" :text "${window}") (controls :halign "end"))) (defwidget left_bar [] (box :class "bar side-bar left-bar ${current_monitor == 'HDMI-A-1' ? 'active' : ''}" :halign "end" (workspaces :ids "[\"6\",\"7\"]"))) (defwidget right_bar [] (box :class "bar side-bar right-bar ${current_monitor == 'DP-3' ? 'active' : ''}" :halign "start" (workspaces :ids "[\"8\",\"9\"]"))) ; WIDGETS (defwidget workspaces [ids] (box :space-evenly false :spacing 10 :class "workspaces" (for id in ids (eventbox :onclick "hyprctl dispatch workspace ${id}" (box :class "workspace-entry ${current_workspace == id ? 'active' : 'inactive'} ${(workspaces?.[id]?.windows?:0) >= 1 ? 'has-windows' : 'no-windows'}"))))) (defwidget datetime [] (box :space-evenly false :class "datetime" :spacing 10 (label :class "date" :text "${date}") (label :class "time" :text "${time}"))) (defwidget controls [] (box :space-evenly false :class "controls" :halign "end" (metric :icon {volume?.["icon"]?:""} :value {volume?.["audio"] != "1" ? 0 : volume?.["percent"]} :onchange "~/.config/eww/scripts/volume setvol SINK {}" :onclick "~/.config/eww/scripts/volume mute SINK"))) (defwidget metric [value ?icon ?onchange ?onclick] (box :space-evenly false :class "metric" :spacing 10 :halign "end" :visible {(value?:-1) != -1} (scale :class "scale" :min 0 :max 101 :flipped true :orientation 'h' :active {(onchange?:"") != ""} :onchange {onchange} :value {value?:0}) (eventbox :active {(onclick?:"") != ""} :onclick {onclick} (box (label :width 1 :visible {icon != ""} :class "icon" :text {icon}) (label :width 35 :class "label" :text "${value}%")))))