From a32286fc67b4cbd64492602100d0c83e68765a22 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 24 Oct 2023 06:17:59 -0500 Subject: [PATCH] making eww work more like waybar workspaces --- .config/eww/eww.scss | 6 +++--- .config/eww/eww.yuck | 25 +++++++++++++----------- .config/eww/scripts/get-active-workspace | 10 +++++++--- .config/eww/scripts/get-workspaces | 2 +- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.config/eww/eww.scss b/.config/eww/eww.scss index 3d9b406..238ccab 100644 --- a/.config/eww/eww.scss +++ b/.config/eww/eww.scss @@ -312,9 +312,9 @@ tooltip label { } .works { - font-size: 14px; + font-size: 15px; font-weight: normal; - margin: 2px 0px 0px 0px; + margin: 0px 0px 0px 0px; background-color: rgba(00, 00, 00, 0.0); padding-left: 5px; padding-right: 9px; @@ -323,7 +323,7 @@ tooltip label { .worksbox { font-size: 14px; padding-left: 15px; - // padding-right: 15px; + padding-right: 10px; background-color: rgba(00, 00, 00, 0.0); } diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck index 73660b9..98f90ca 100644 --- a/.config/eww/eww.yuck +++ b/.config/eww/eww.yuck @@ -45,17 +45,20 @@ :space-evenly false :valign "center" (for workspace in workspaces - (button :onclick "hyprctl dispatch workspace ${workspace.id}" :class "works ${workspace.id == current_workspace ? "current_workspace" : ""} ${workspace.windows > 0 ? "occupied_workspace" : "empty_workspace"}" - "${workspace.id == 1 ? "" : - workspace.id == 2 ? "" : - workspace.id == 3 ? "󰈙" : - workspace.id == 4 ? "󰭹" : - workspace.id == 5 ? "" : - workspace.id == 6 ? "" : - workspace.id == 7 ? "󰕧" : - workspace.id == 8 ? "󰭹" : - workspace.id == 9 ? "" : - workspace.id}"))))) + (button + :onclick "hyprctl dispatch workspace ${workspace.id}" + :class "works ${workspace.id == current_workspace ? "current_workspace" : ""} ${workspace.windows > 0 ? "occupied_workspace" : "empty_workspace"}" + :visible {workspace.windows > 0 ? "true" : workspace.id == current_workspace ? "true" : "false"} + "${workspace.id == 1 ? "" : + workspace.id == 2 ? "" : + workspace.id == 3 ? "󰈙" : + workspace.id == 4 ? "󰭹" : + workspace.id == 5 ? "" : + workspace.id == 6 ? "" : + workspace.id == 7 ? "󰕧" : + workspace.id == 8 ? "󰭹" : + workspace.id == 9 ? "" : + workspace.id}"))))) diff --git a/.config/eww/scripts/get-active-workspace b/.config/eww/scripts/get-active-workspace index 6223a4f..0c92372 100755 --- a/.config/eww/scripts/get-active-workspace +++ b/.config/eww/scripts/get-active-workspace @@ -1,5 +1,9 @@ #!/usr/bin/env bash -hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id' +active (){ + hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id' +} + +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do + active +done -socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | - stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}' diff --git a/.config/eww/scripts/get-workspaces b/.config/eww/scripts/get-workspaces index e786651..91853b9 100755 --- a/.config/eww/scripts/get-workspaces +++ b/.config/eww/scripts/get-workspaces @@ -7,5 +7,5 @@ spaces (){ spaces socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do - spaces + hyprctl workspaces -j done