From bf3abbbeae38d3904c54f6f17fcb8631e7dd89fe Mon Sep 17 00:00:00 2001 From: 4Lost Date: Sat, 3 May 2025 14:14:25 +0200 Subject: [PATCH] eww add seperators & layouts --- home/programs/eww/src/bar.yuck | 126 ++++++++++++++----- home/programs/eww/src/eww.scss | 26 ++-- home/programs/eww/src/scripts/xmonad_logs.sh | 4 +- home/programs/xmonad/src/xmonad.hs | 2 +- 4 files changed, 110 insertions(+), 48 deletions(-) diff --git a/home/programs/eww/src/bar.yuck b/home/programs/eww/src/bar.yuck index 17f7c48..3550a11 100644 --- a/home/programs/eww/src/bar.yuck +++ b/home/programs/eww/src/bar.yuck @@ -72,7 +72,7 @@ (defpoll date :interval "1s" :initial "-" - `date '+ %a %d.%m.%y  %H:%M'`) + `date '+ %a %d.%m.%y %H:%M'`) (defvar ws1 "ws-empty") (defvar ws2 "ws-empty") @@ -84,6 +84,8 @@ (defvar ws8 "ws-empty") (defvar ws9 "ws-empty") + (defvar layouts "") + ;; /-- Blocks --> (defwidget widgetWorkspaces [] (box @@ -149,53 +151,108 @@ :onclick "wmctrl -s 8" :class "workspace-button ${ws9}" (label - :text "9")) - (label - :text " "))) + :text "9")))) (defwidget widgetWindows [] (label - :text "| ${windows}")) + :text "${windows}")) - (defwidget widgetMic [] + (defwidget widgetLayouts [] (label - :class micClass - :text "${micIcon} ")) + :text "${layouts}")) + + (defwidget widgetLogSeperator [] + (label + :class "text separator" + :text "⦁")) (defwidget widgetSpeaker [] - (label - :class speakerClass - :text "${speakerIcon} ${speakerVolume}% ")) + (box + :space-evenly false + (label + :class speakerClass + :text "${speakerIcon} ") + (label + :class "text" + :text "${speakerVolume}% ") + (label + :class micClass + :text "${micIcon}"))) (defwidget widgetBacklight [] - (label - :class "backlight" - :text " ${backlight}% ")) + (box + :space-evenly false + (label + :class "backlight" + :text " ") + (label + :class "text" + :text "${backlight}%"))) (defwidget widgetCpu [] - (label - :class "cpu" - :text " ${cpu}% ")) + (box + :space-evenly false + (label + :class "cpu" + :text " ") + (label + :class "text" + :text "${cpu}%"))) (defwidget widgetMemory [] - (label - :class "memory" - :text " ${memory}% ")) + (box + :space-evenly false + (label + :class "memory" + :text " ") + (label + :class "text" + :text "${memory}%"))) (defwidget widgetBattery [] - (label - :class batteryClass - :text "${batteryIcon} ${batteryVolume}% ")) + (box + :space-evenly false + (label + :class batteryClass + :text "${batteryIcon} ") + (label + :class "text" + :text "${batteryVolume}%"))) (defwidget widgetNetworkDown [] - (label - :class "networkDown" - :text " ${networkDown}KiB ")) + (box + :space-evenly false + (label + :class "networkDown" + :text " ") + (label + :class "text" + :text "${networkDown}"))) (defwidget widgetNetworkUp [] + (box + :space-evenly false + (label + :class "networkUp" + :text " ") + (label + :class "text" + :text "${networkUp}"))) + + (defwidget widgetTime [] + (box + :space-evenly false + (label + :class "time" + :text " ") + (label + :class "text" + :text "${date}"))) + + (defwidget widgetSeperator [] (label - :class "networkUp" - :text " ${networkUp}KiB ")) + :class "text separator" + :text "|")) ;; /-- Bar --> (defwindow bar [] @@ -215,16 +272,25 @@ :space-evenly false :class "bar" (widgetWorkspaces) + (widgetLogSeperator) + (widgetLayouts) + (widgetLogSeperator) (widgetWindows) (box :hexpand true) - (widgetMic) (widgetSpeaker) + (widgetSeperator) (widgetBacklight) + (widgetSeperator) (widgetCpu) + (widgetSeperator) (widgetMemory) + (widgetSeperator) (widgetBattery) + (widgetSeperator) (widgetNetworkDown) + (widgetSeperator) (widgetNetworkUp) - (label :text date) + (widgetSeperator) + (widgetTime) ) ) diff --git a/home/programs/eww/src/eww.scss b/home/programs/eww/src/eww.scss index 6ea32ae..3253751 100644 --- a/home/programs/eww/src/eww.scss +++ b/home/programs/eww/src/eww.scss @@ -9,8 +9,11 @@ $violet: #cba6f7; $blue: #89b4fa; $gold: #fab387; + $orange: #fab387; // <-- Prepare all --> - * { all: unset; } + * {all: unset;} + .text {color: $white-text;} + .separator {padding: 0px 4px;} // <-- Bar --> // <-- Widgets --> // <-- Audio --> @@ -32,21 +35,12 @@ // <-- Network --> .networkUp {color: $blue;} // <-- Workspaces --> - .workspace-button { - background: $grey-background; - } - .ws-current { - color: $green; - } - .ws-visible { - color: $red; - } - .ws-hidden { - color: $white-text; - } - .ws-empty { - color: $grey-text; - } + .workspace-button {background: $grey-background;} + .ws-current {color: $green;} + .ws-visible {color: $red;} + .ws-hidden {color: $white-text;} + .ws-empty {color: $grey-text;} + .time {color: $orange;} // <-- Window --> .bar { padding: 0.2em 1em; diff --git a/home/programs/eww/src/scripts/xmonad_logs.sh b/home/programs/eww/src/scripts/xmonad_logs.sh index 4b97f07..663ee37 100755 --- a/home/programs/eww/src/scripts/xmonad_logs.sh +++ b/home/programs/eww/src/scripts/xmonad_logs.sh @@ -1,5 +1,5 @@ line=$(cat /tmp/xmonad-eww-log) -IFS='|' read -r workspaces windows <<<"$line" +IFS='|' read -r workspaces layouts windows <<<"$line" # Workspaces workspaceArray=($workspaces) i=0 @@ -15,5 +15,7 @@ for ws in "${workspaceArray[@]}"; do eww update ws$i="ws-empty" fi done +# Layouts +eww update layouts="${layouts}" # Windows echo "${windows}" diff --git a/home/programs/xmonad/src/xmonad.hs b/home/programs/xmonad/src/xmonad.hs index 971c5d7..acc0fa2 100644 --- a/home/programs/xmonad/src/xmonad.hs +++ b/home/programs/xmonad/src/xmonad.hs @@ -76,7 +76,7 @@ myXmobarPP = , ppHiddenNoWindows = id , ppUrgent = wrap "!" "!" , ppSep = "|" - , ppOrder = \(ws : _ : _ : wins : _) -> [ws, wins] + , ppOrder = \(ws : layout : _ : wins : _) -> [ws, layout, wins] , ppExtras = [logTitles formatFocused formatUnfocused] } where