rework eww - still wip

This commit is contained in:
2025-08-30 18:37:22 +02:00
parent 79fb4b1f2a
commit 84ee3b6b12
10 changed files with 84 additions and 113 deletions

View File

@@ -0,0 +1,8 @@
TEMP_FILE="/tmp/river-eww-status"
while true; do
ristate -t >"$TEMP_FILE.tmp"
ristate -w >>"$TEMP_FILE.tmp"
mv "$TEMP_FILE.tmp" "$TEMP_FILE"
sleep 1
done

View File

@@ -0,0 +1,32 @@
TEMP_FILE="/tmp/river-eww-status"
# Read last two lines (layout/tags and focused window)
json=$(tail -n2 "$TEMP_FILE" | head -n1)
win_json=$(tail -n1 "$TEMP_FILE")
# Extract layout
layout=$(echo "$json" | jq -r '.layout // ""')
# Extract focused window title
windows=$(echo "$win_json" | jq -r '.title // ""')
# Extract focused tags as array
mapfile -t focused_tags < <(echo "$json" | jq -r '.tags.BOE // [] | .[]')
# Update workspace classes
for i in $(seq 1 9); do
class="ws-empty"
for tag in "${focused_tags[@]}"; do
if [[ "$tag" == "$i" ]]; then
class="ws-current"
break
fi
done
eww update ws$i="$class"
done
# Update layout
eww update layouts="$layout"
# Output focused window for widget
echo "$windows"

View File

@@ -1,6 +0,0 @@
socat - UNIX-CONNECT:"$XDG_RUNTIME_DIR"/river/status | while read -r line; do
workspace=$(echo "$line" | jq -r '.workspace')
layout=$(echo "$line" | jq -r '.layout')
title=$(echo "$line" | jq -r '.title')
echo "WS: $workspace | Layout: $layout | $title"
done

View File

@@ -1,21 +0,0 @@
line=$(cat /tmp/xmonad-eww-log)
IFS='|' read -r workspaces layouts windows <<<"$line"
# Workspaces
workspaceArray=($workspaces)
i=0
for ws in "${workspaceArray[@]}"; do
i=$((i + 1))
if [[ "$ws" == [\[]* ]]; then
eww update ws$i="ws-current"
elif [[ "$ws" == [\(]* ]]; then
eww update ws$i="ws-visible"
elif [[ "$ws" == [\{]* ]]; then
eww update ws$i="ws-hidden"
else
eww update ws$i="ws-empty"
fi
done
# Layouts
eww update layouts="${layouts}"
# Windows
echo "${windows}"