From 241e988813fe5a69cbcab54393d780da64b7ba89 Mon Sep 17 00:00:00 2001 From: Ezri Brimhall Date: Wed, 5 Feb 2025 15:26:37 -0700 Subject: [PATCH] Unified eww configs --- .config/eww/eww.scss | 8 +- .config/eww/eww.yuck | 86 ++++++++----------- .config/eww/modules/volume.yuck | 51 +++++++++++ .config/eww/windows.yuck | 86 ++++++++++++++++++- .../sway/workspaces.json##hostname.zariman | 51 ++++++++--- 5 files changed, 218 insertions(+), 64 deletions(-) diff --git a/.config/eww/eww.scss b/.config/eww/eww.scss index cbe9000..1b20997 100644 --- a/.config/eww/eww.scss +++ b/.config/eww/eww.scss @@ -19,12 +19,18 @@ margin-bottom: 0px; } - &.side { + &.left-side { margin: 10px; margin-top: 20px; margin-right: 0px; } + &.right-side { + margin: 10px; + margin-top: 20px; + margin-left: 0px; + } + &.bg { background-color: $bg0; padding: 10px; diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck index 94cd9f2..6d5fdd6 100644 --- a/.config/eww/eww.yuck +++ b/.config/eww/eww.yuck @@ -12,8 +12,7 @@ (include "./windows.yuck") -(defwindow leftbar - :monitor 1 +(defwindow desktop-leftbar [group] :geometry (geometry :width "100%" :height "36px" :anchor "top center") @@ -22,26 +21,24 @@ :stacking "fg" (centerbox :orientation "h" :class "bar root" - (tycho-leftbar--left) - (tycho-leftbar--center) - (tycho-leftbar--right))) + (hostname-leftalign) + '' + (ws-group-rightalign :workspace-group {group}))) -(defwindow centerbar - :monitor 0 +(defwindow desktop-mainbar [group] :geometry (geometry :width "100%" - :height "26px" + :height "36px" :anchor "top center") :exclusive true :focusable false :stacking "fg" (centerbox :orientation "h" :class "bar root" - (tycho-centerbar--left) - (tycho-centerbar--center) - (tycho-centerbar--right))) + (ws-group-leftalign :workspace-group {group}) + (hostname-centeralign) + (desktop-details-rightalign))) -(defwindow rightbar - :monitor 2 +(defwindow desktop-rightbar [group] :geometry (geometry :width "100%" :height "36px" :anchor "top center") @@ -50,58 +47,47 @@ :stacking "fg" (centerbox :orientation "h" :class "bar root" - (tycho-rightbar--left) - (tycho-rightbar--center) - (tycho-rightbar--right))) + (ws-group-leftalign :workspace-group {group}) + '' + (hostname-rightalign))) -(defwindow sidebar - :monitor 1 +(defwindow sidebar [group side] :geometry (geometry :width "200px" :height "100%" - :anchor "left center") + :anchor "${side} center") :exclusive true :focusable false :stacking "fg" - (tycho-sidebar)) + (sidebar :orientation {side})) -(defwindow network-status - :monitor 0 - :geometry (geometry :width "200px" - :height "0px" - :x "300px" - :y "0px" - :anchor "top right") - :exclusive false - :focusable false - :stacking "overlay" - (box :orientation "v" - :class "bar root bg outline" - :visible {network--show-details} - (network-detail))) +;; (defwindow network-status +;; :monitor 0 +;; :geometry (geometry :width "200px" +;; :height "0px" +;; :x "300px" +;; :y "0px" +;; :anchor "top right") +;; :exclusive false +;; :focusable false +;; :stacking "overlay" +;; (box :orientation "v" +;; :class "bar root bg outline" +;; :visible {network--show-details} +;; (network-detail))) -(defwindow builtinbar - :monitor 0 +(defwindow laptopbar [group battery] :geometry (geometry :width "100%" :height "36px" :anchor "top center") :exclusive true :focusable false :stacking "fg" - (centerbox :orientation "h" :class "bar root ${power--state == 'critical' ? 'reservepower' : ''}" - (rocinante-builtinbar--left) - (rocinante-builtinbar--center) - (rocinante-builtinbar--right))) + (centerbox :orientation "h" + :class "bar root" + (ws-group-leftalign :workspace-group {group}) + (hostname-centeralign) + (laptop-details-rightalign :battery {battery} ))) - -(defwindow polkit - :geometry (geometry - :anchor "center") - :focusable true - :exclusive false - :stacking "overlay" - (box :orientation "v" - :class "bar root bg outline" - "testing")) diff --git a/.config/eww/modules/volume.yuck b/.config/eww/modules/volume.yuck index 80efe83..a4c8342 100644 --- a/.config/eww/modules/volume.yuck +++ b/.config/eww/modules/volume.yuck @@ -27,3 +27,54 @@ (label :class {volume--data.input.mute ? "offline" : "special"} :text "${volume--data.input.volume}%")) "audio system")) + +(defwidget volume--gauge [io] + (box :orientation "v" + :halign {io == "in" ? "start" : "end"} + :width 95 + :space-evenly false + :spacing 10 + :class "nebula" + (label :text {io}) + (box :halign "center" + (overlay + (system--gauge :value {volume--data["${io}put"].volume} + :threshold {volume--data["${io}put"].mute ? 0 : 100}) + (transform :translate-y "-2px" + (box + (box :halign "center" + :valign "center" + :orientation "h" + :space-evenly false + :visible {!volume--data["${io}put"].mute} + (label :text "%" + :class "invisible") + (label :text {round(volume--data["${io}put"].volume, 0)} + :class "special") + (label :text "%" + :class "offline")) + (box :halign "center" + :valign "center" + :orientation "h" + :space-evenly false + :visible {volume--data["${io}put"].mute} + (label :text "mute" + :class "offline")) + )))))) + +(defwidget volume-gauges [] + (box :orientation "v" + :space-evenly false + :spacing 10 + :width 200 + :halign "start" + :class "nebula" + (label :class "medium special" + :text "Audio") + (box :orientation "h" + :space-evenly false + :width 200 + :halign "start" + :spacing 10 + (volume--gauge :io "out") + (volume--gauge :io "in")))) diff --git a/.config/eww/windows.yuck b/.config/eww/windows.yuck index ec77b2a..595fa83 100644 --- a/.config/eww/windows.yuck +++ b/.config/eww/windows.yuck @@ -2,9 +2,89 @@ ;; Top-Level Module Definitions ;; ;;;; ;;;; -;;; ;;; -;; PolKit Auth Window ;; -;;; ;;; +;;; ;;; +;; Generic Windows ;; +;;; ;;; + +(defwidget sidebar [orientation] + (box :orientation "v" + :valign "start" + :space-evenly false + :spacing 20 + :class "root ${orientation}-side" + (sideclock) + (network-sidebar-details) + (system-gauges) + (volume-gauges))) + +(defwidget ws-group-rightalign [workspace-group] + (box :orientation "h" + :halign "end" + :space-evenly false + :spacing 20 + :class "rightbox" + (sway-workspace :group {workspace-group}) + (sway-workspaces :group {workspace-group}))) + +(defwidget ws-group-leftalign [workspace-group] + (box :orientation "h" + :halign "start" + :space-evenly false + :spacing 20 + :class "leftbox" + (sway-workspaces :group {workspace-group}) + (sway-workspace :group {workspace-group}))) + + +(defwidget desktop-details-rightalign [] + (box :orientation "h" + :halign "end" + :space-evenly false + :spacing 20 + :class "rightbox" + (vpn-network) + (mpris2) + (network) + (system-memory) + (system-cpu-avg) + (clock))) + +(defwidget hostname-centeralign [] + (box :orientation "h" + :halign "center" + :space-evenly false + :spacing 20 + :class "centerbox" + (system-name))) + +(defwidget hostname-leftalign [] + (box :orientation "h" + :halign "start" + :space-evenly false + :spacing 20 + :class "leftbox" + (system-name))) + +(defwidget hostname-rightalign [] + (box :orientation "h" + :halign "end" + :space-evenly false + :spacing 20 + :class "rightbox" + (system-name))) + +(defwidget laptop-details-rightalign [?battery] + (box :orientation "h" + :halign "end" + :space-evenly false + :spacing 20 + :class "rightbox" + (vpn-network) + (network) + (system-battery :battery {battery ?: "BAT1"}) + (audio) + (clock))) + ;;; ;;; ;; Bars for Rocinante ;; diff --git a/.config/sway/workspaces.json##hostname.zariman b/.config/sway/workspaces.json##hostname.zariman index 8a8881c..c48f495 100644 --- a/.config/sway/workspaces.json##hostname.zariman +++ b/.config/sway/workspaces.json##hostname.zariman @@ -167,7 +167,11 @@ "names": ["eDP-1"], "group": "builtin", "position": [0, 600], - "eww_windows": ["builtinbar"], + "eww_windows": { + "laptopbar": { + "battery": "BAT1" + } + }, "mode": "2560x1600@165Hz scale 1.5 color_profile icc /usr/share/color/icc/colord/BOE_CQ_______NE160QDM_NZ6.icm" }, { @@ -177,7 +181,12 @@ "group": "left", "position": [1707, 0], "mode": "2560x1440@120Hz", - "eww_windows": ["leftbar", "sidebar"] + "eww_windows": { + "desktop-leftbar": {}, + "sidebar": { + "side": "left" + } + } }, { "make": "Dell Inc.", @@ -186,7 +195,7 @@ "group": "center", "position": [4267, 0], "mode": "3840x1600", - "eww_windows": ["centerbar"] + "eww_windows": ["desktop-mainbar"] }, { "make": "Acer Technologies", @@ -195,7 +204,12 @@ "group": "right", "position": [8107, 0], "mode": "2560x1440@120Hz", - "eww_windows": ["rightbar"] + "eww_windows": { + "desktop-rightbar": {}, + "sidebar": { + "side": "right" + } + } } ], "groups": { @@ -224,7 +238,11 @@ "names": ["eDP-1"], "group": "builtin", "position": [0, 600], - "eww_windows": ["builtinbar"], + "eww_windows": { + "laptopbar": { + "battery": "BAT1" + } + }, "mode": "2560x1600@165Hz scale 1.5 color_profile icc /usr/share/color/icc/colord/BOE_CQ_______NE160QDM_NZ6.icm" }, { @@ -234,7 +252,12 @@ "group": "left", "position": [1707, 200], "mode": "1920x1080@75Hz", - "eww_windows": ["leftbar", "sidebar"] + "eww_windows": { + "desktop-leftbar": {}, + "sidebar": { + "side": "left" + } + } }, { "make": "ASUSTek COMPUTER INC", @@ -243,7 +266,7 @@ "group": "center", "position": [3627, 0], "mode": "2560x1440@165Hz", - "eww_windows": ["centerbar"] + "eww_windows": ["desktop-mainbar"] }, { "make": "ASUSTek COMPUTER INC", @@ -252,7 +275,7 @@ "group": "right", "position": [6187, 200], "mode": "1920x1080@75Hz", - "eww_windows": ["rightbar"] + "eww_windows": ["desktop-rightbar"] } ], "groups": { @@ -281,7 +304,11 @@ "names": ["eDP-1"], "group": "builtin", "position": [0, 0], - "eww_windows": ["builtinbar"], + "eww_windows": { + "laptopbar": { + "battery": "BAT1" + } + }, "mode": "2560x1600@165Hz scale 1.25 color_profile icc /usr/share/color/icc/colord/BOE_CQ_______NE160QDM_NZ6.icm" } ], @@ -299,7 +326,11 @@ "names": ["eDP-1"], "group": "builtin", "position": [0, 0], - "eww_windows": ["builtinbar"], + "eww_windows": { + "laptopbar": { + "battery": "BAT1" + } + }, "mode": "2560x1600@165Hz scale 1.25 color_profile icc /usr/share/color/icc/colord/BOE_CQ_______NE160QDM_NZ6.icm" } ],