;; Window Info (deflisten window :initial "{}" "scripts/active-window") (defwidget bar_window [class-limit title-limit] (box :class "bar-window" :orientation "v" :space-evenly false (label :class "detail" :halign "start" :valign "end" :limit-width class-limit :text {window.class ?: "Desktop"}) (label :halign "start" :valign "end" :limit-width title-limit :text {window.title ?: "Workspace ${current_workspace}"}))) ;; Workspaces (deflisten workspaces :initial "[]" "scripts/get-workspaces") (deflisten current_workspace :initial "1" "scripts/get-active-workspace") (defwidget bar_workspace_button [workspace] (eventbox :onclick "hyprctl dispatch workspace ${workspace.id}" (overlay (box :class "workspace-button ${workspace.id == current_workspace ? "current" : "" } ${workspace.windows > 0 ? "occupied" : "empty" } ${workspace.previous > 0 ? "previous-occupied" : "previous-empty" } ${workspace.next > 0 ? "next-occupied" : "next-empty"}" {workspace.id}) (box :visible {workspace.id == current_workspace} {workspace.id})))) (defwidget bar_workspaces [] (eventbox :onscroll "scripts/change-active-workspace {} ${current_workspace}" (box :class "bar-workspaces" :orientation "h" :space-evenly true (for workspace in workspaces (bar_workspace_button :workspace workspace))))) ;; Time (defwidget bar_time [width] (box :class "bar-time segment" :orientation "h" :width width :space-evenly false :spacing 6 (label :halign "start" :yalign 0.5 :text {formattime(EWW_TIME, "%H:%M:%S")}) (label :class "bar-date" :halign "end" :hexpand true :yalign 0.5 :text {formattime(EWW_TIME, "%a %Y-%m-%d")}))) ;; Playerctl (deflisten mpris :initial "{}" "scripts/mpris-metadata") (defwidget bar_music [artist-limit title-limit] (eventbox :onclick "playerctl play-pause" (box :class "bar-music" :orientation "h" :space-evenly false (box :class "progress" (overlay (circular-progress :class "back" :value 100 :width 25 :thickness 2) (circular-progress :class "front" :value {(mpris.position ?: 0) == 0 || (mpris.duration ?: 0) == 0 ? 0 : mpris.position > mpris.duration ? 100 : mpris.position / mpris.duration * 100} :width 25 :thickness 2 :start-at 75 :clockwise true) (label :class "symbol ${(mpris.title ?: "") == "" || (mpris.status ?: "Stopped") == "Stopped" ? "stopped" : mpris.status == "Playing" ? "playing" : "paused"}" :text {(mpris.title ?: "") == "" || (mpris.status ?: "Stopped") == "Stopped" ? "" : mpris.status == "Playing" ? "󰏤" : ""}))) (revealer :transition "slideright" :duration "800ms" :reveal {(mpris.title ?: "") != "" && (mpris.status ?: "Stopped") != "Stopped"} (box :orientation "v" :class "bar-music-meta" :space-evenly false (label :class "bar-artist detail" :halign "start" :limit-width artist-limit :text {mpris.artist ?: ""}) (label :class "bar-title" :halign "start" :limit-width title-limit :text {mpris.title ?: ""})))))) ;; Scales (Volume + Brightness) (defwidget bar_scale [?class reveal-name reveal value symbol onchange ?onclick] (eventbox :onhover "${EWW_CMD} update ${reveal-name}=true" :onhoverlost "${EWW_CMD} update ${reveal-name}=false" (box :class "bar-scale ${class}" :space-evenly false (eventbox :onclick onclick (label :class "symbol" :text symbol)) (revealer :transition "slideright" :reveal reveal :duration "400ms" (scale :value value :orientation "h" :width "100%" :min 0 :max 101 :onchange onchange)) (eventbox :onclick onclick (label :class "percent" :width 29 :xalign 0 :text "${value}%"))))) (defvar volume_reveal false) (deflisten volume :initial "0" "scripts/volume") (defwidget bar_volume [] (bar_scale :class "bar-volume ${volume.muted ? "muted" : ""}" :reveal-name "volume_reveal" :reveal volume_reveal :value {volume.value} :symbol {volume.muted ? "󰝟" : volume.value < 5 ? "󰖁" : volume.value < 35 ? "󰕿" : volume.value < 66 ? "󰖀" : "󰕾"} :onchange "pamixer --set-volume {}" :onclick "pamixer -t")) (defvar brightness_reveal false) (deflisten brightness :initial "0" "scripts/brightness") (defwidget bar_brightness [] (bar_scale :class "bar-brightness" :reveal-name "brightness_reveal" :reveal brightness_reveal :value brightness :symbol "󰃠" :onchange "brightnessctl -e s {}%")) ;; Circular Indicators (defwidget bar_circular [?class ?critical ?tooltip value symbol] (box :class "bar-circular ${class} ${(critical ?: false) ? "critical" : ""}" :orientation "h" :tooltip tooltip (overlay (circular-progress :class "back" :value 100 :width 25 :thickness 2 :start-at 75 :clockwise true) (circular-progress :class "front" :value value :width 25 :thickness 2 :start-at 75 :clockwise true) (label :class "symbol" :text symbol)))) (defwidget bar_battery [] (bar_circular :class "bar-battery" :critical {EWW_BATTERY["BAT1"].capacity <= 15 && EWW_BATTERY["BAT1"].status != "Charging"} :tooltip "Battery: ${EWW_BATTERY["BAT1"].capacity}%${ EWW_BATTERY["BAT1"].status == "Charging" ? " (Charging)" : ""}" :value {EWW_BATTERY["BAT1"].capacity} :symbol {EWW_BATTERY["BAT1"].status == "Charging" ? "󰂄" : "󰁹"})) (defwidget bar_ram [] (bar_circular :class "bar-ram" :critical {EWW_RAM.used_mem_perc >= 80} :tooltip "RAM: ${round(EWW_RAM.used_mem / 1073741824, 2) } / ${round(EWW_RAM.total_mem / 1073741824, 2)} GB (${round(EWW_RAM.used_mem_perc, 2)}%)" :value {EWW_RAM.used_mem_perc} :symbol "")) (defwidget bar_storage [] (bar_circular :class "bar-storage" :critical {EWW_DISK["/"].used_perc >= 95} :tooltip "Storage: ${round(EWW_DISK["/"].used / 1073741824, 2) } / ${round(EWW_DISK["/"].total / 1073741824, 0)} GB (${round(EWW_DISK["/"].used_perc, 2)}%)" :value {EWW_DISK["/"].used_perc} :symbol "󰆼")) ;; Network (defpoll wifi :interval "5s" :initial "{}" "scripts/network 802-11-wireless") (defpoll ethernet :interval "5s" :initial "{}" "scripts/network 802-3-ethernet") (defpoll bluetooth :interval "5s" :initial "{}" "scripts/network bluetooth") (defvar internet_reveal false) (defwidget bar_internet [] (box :class "bar-internet ${wifi == "{}" && ethernet == "{}" ? "disabled" : ""}" :space-evenly false :tooltip {ethernet != "{}" ? "${ethernet.name} (${ethernet.device})" : wifi != "{}" ? "${wifi.name} (${wifi.device})" : ""} {wifi != "{}" ? "󰤨" : ethernet != "{}" ? "󰈀" : "󰤮"})) (defwidget bar_bluetooth [] (box :class "bar-bluetooth ${bluetooth == "{}" ? "disabled" : ""}" {bluetooth != "{}" ? "󰂯" : "󰂲"})) ;; Power Menu (defpoll idleinhibit :interval "10s" :initial "0" "pgrep -c -f wayland\"\"-idle-inhibitor || true") (defwidget bar_power [] (eventbox :onclick "${EWW_CMD} active-windows | grep -q power \ && ${EWW_CMD} close power || ${EWW_CMD} open power" (box :class "bar-power" "⏻"))) (defwindow power :monitor 0 :geometry (geometry :width "375px" :height "150px" :anchor "top right") :namespace "eww-bar" :stacking "fg" :exclusive false :focusable false (eventbox :onhoverlost "${EWW_CMD} close power" (box :class "power" :orientation "v" (box :orientation "h" (button :onclick "systemctl suspend" :tooltip "Sleep" (box :style "color: #9aa5ce;" "󰤄")) (button :onclick "hyprlock --immediate &" :tooltip "Lock" (box :style "color: #cfc9c2;" "")) (button :onclick "hyprctl dispatch exit" :tooltip "Log Out" (box :style "color: #7dcfff; padding-left: 0.3ex;" "")) (button :onclick "reboot" :tooltip "Reboot" (box :style "color: #e0af68;" "")) (button :onclick "poweroff" :tooltip "Shutdown" (box :style "color: #f7768e; font-size: 1.35em; padding-bottom: 0.15ex;" "⏼"))) (box :orientation "h" (box) (box) (box) (box) (button :onclick "scripts/toggle-idle-inhibit && ${EWW_CMD} poll idleinhibit" :tooltip "Idle Inhibitor: ${idleinhibit > 0 ? "On" : "Off"}" (box :style "padding-right: 0.5ex; ${idleinhibit > 0 ? "color: #ff9e64" : "color: #565f89; padding-top: 0.3ex;"}" {idleinhibit > 0 ? "󰈈" : "󰛑"})))))) ;; Separator (defwidget bar_sep [] (box :class "bar-sep" :hexpand false :vexpand false "|")) ;; Bar Layout (defwidget fire_bar_left_edge [] (box :orientation "h" :space-evenly false :halign "start" :hexpand true (bar_window :class-limit 60 :title-limit 50))) (defwidget fire_bar_left_wing [] (box :orientation "h" :space-evenly false :halign "end" :hexpand true (bar_time :width 175))) (defwidget fire_bar_center [] (bar_workspaces)) (defwidget fire_bar_right_wing [] (box :orientation "h" :space-evenly false :hexpand true (bar_music :width 175 :artist-limit 30 :title-limit 25))) (defwidget fire_bar_right_edge [] (box :orientation "h" :space-evenly false :halign "end" :hexpand true (bar_volume) (bar_brightness) (bar_sep) (bar_bluetooth) (bar_internet) (bar_sep) (bar_storage) (bar_ram) (bar_battery) (bar_sep) (bar_power))) (defwidget fire_bar_layout [] (centerbox :class "bar" :orientation "h" (box :orientation "h" :space-evenly false :hexpand true (fire_bar_left_edge) (fire_bar_left_wing)) (fire_bar_center) (box :orientation "h" :space-evenly false (fire_bar_right_wing) (fire_bar_right_edge)))) (defwidget earth_bar_left_edge [] (box :orientation "h" :space-evenly false :halign "start" :hexpand true (bar_window :class-limit 90 :title-limit 80))) (defwidget earth_bar_left_wing [] (box :orientation "h" :space-evenly false :halign "end" :hexpand true (bar_time :width 175))) (defwidget earth_bar_center [] (bar_workspaces)) (defwidget earth_bar_right_wing [] (box :orientation "h" :space-evenly false :hexpand true (bar_music :width 175 :artist-limit 30 :title-limit 25))) (defwidget earth_bar_right_edge [] (box :orientation "h" :space-evenly false :halign "end" :hexpand true (bar_volume) (bar_sep) (bar_bluetooth) (bar_internet) (bar_sep) (bar_storage) (bar_ram) (bar_sep) (bar_idleinhibit))) (defwidget earth_bar_layout [] (centerbox :class "bar" :orientation "h" (box :orientation "h" :space-evenly false :hexpand true (earth_bar_left_edge) (earth_bar_left_wing)) (earth_bar_center) (box :orientation "h" :space-evenly false (earth_bar_right_wing) (earth_bar_right_edge)))) (defwindow fire_bar :monitor 0 :geometry (geometry :width "100%" :height "35px" :anchor "top center") :namespace "eww-bar" :stacking "fg" :exclusive true :focusable false (fire_bar_layout)) (defwindow earth_bar :monitor 0 :geometry (geometry :width "100%" :height "35px" :anchor "top center") :namespace "eww-bar" :stacking "fg" :exclusive true :focusable false (earth_bar_layout))