summaryrefslogtreecommitdiff
path: root/.config/eww
diff options
context:
space:
mode:
Diffstat (limited to '.config/eww')
-rw-r--r--.config/eww/eww.yuck4
-rwxr-xr-x.config/eww/scripts/active-workspace-listener2
-rwxr-xr-x.config/eww/scripts/workspace-list-listener25
3 files changed, 14 insertions, 17 deletions
diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck
index b50fcc0..b1b02ca 100644
--- a/.config/eww/eww.yuck
+++ b/.config/eww/eww.yuck
@@ -2,7 +2,7 @@
(deflisten active-workspace
`stdbuf -oL scripts/active-workspace-listener`)
-(deflisten workspace-list :initial '[1]'
+(deflisten workspace-list :initial '[[1]]'
`stdbuf -oL scripts/workspace-list-listener`)
(deflisten datetime
@@ -73,7 +73,7 @@
(defwidget workspaces [monitor]
(box :class "workspaces"
:space-evenly false
- (for id in workspace-list
+ (for id in {workspace-list[monitor]}
(button :class {active-workspace[monitor] == id ? "active" : ""}
:onclick `hyprctl dispatch workspace ${id}`
id))))
diff --git a/.config/eww/scripts/active-workspace-listener b/.config/eww/scripts/active-workspace-listener
index 3f57ec5..3c47e87 100755
--- a/.config/eww/scripts/active-workspace-listener
+++ b/.config/eww/scripts/active-workspace-listener
@@ -11,4 +11,4 @@ readonly IPC=/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock
hyprctl -j monitors
esac
done
-} | jq -cr '[.[] | .activeWorkspace.name]'
+} | jq -cr '[.[] | .activeWorkspace.id % 10]'
diff --git a/.config/eww/scripts/workspace-list-listener b/.config/eww/scripts/workspace-list-listener
index 9ad35ca..5ab5c19 100755
--- a/.config/eww/scripts/workspace-list-listener
+++ b/.config/eww/scripts/workspace-list-listener
@@ -2,20 +2,17 @@
readonly IPC=/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock
-ws="`hyprctl -j workspaces | jq -r 'sort_by(.id) | .[] | .name'`"
-jo -a $ws
+hyptctl -j workspaces | jq -cr '
+ [.[].id]
+ | group_by(. / 10 | floor)
+ | [.[] | map(. % 10)]
+'
socat -u UNIX-CONNECT:"$IPC" - \
| stdbuf -oL grep -E '^(create|destroy)workspace>>' \
- | while IFS='>>' read -r e _ n
- do
- case "$e" in
- c*)
- ws="`printf '%s\n%s\n' "$ws" $n | sort -n`"
- ;;
- d*)
- ws="`echo "$ws" | grep -v "^$n$"`"
- ;;
- esac
- jo -a $ws
- done
+ | while read -r _; do hyprctl -j workspaces; done \
+ | jq -cr '
+ [.[].id]
+ | group_by(. / 10 | floor)
+ | [.[] | map(. % 10) | sort_by(.)]
+ '