update
and adapt setup to changes
This commit is contained in:
@@ -198,8 +198,18 @@
|
||||
:text "${date}")))
|
||||
|
||||
;; ── River State ─────────────────────────────────────────────────────
|
||||
(deflisten river_tag
|
||||
:initial ""
|
||||
`ristate -t | jq -r '.tags.Unknown[0] // empty'`)
|
||||
|
||||
(deflisten river_title
|
||||
:initial "-"
|
||||
`ristate -w | jq -r '.title // "-"'`)
|
||||
|
||||
(deflisten river_layout
|
||||
:initial "-"
|
||||
`ristate -l | jq -r '.layout // "-"'`)
|
||||
|
||||
(defvar ws1 "ws-empty")
|
||||
(defvar ws2 "ws-empty")
|
||||
(defvar ws3 "ws-empty")
|
||||
(defvar ws4 "ws-empty")
|
||||
@@ -220,7 +230,7 @@
|
||||
:orientation "horizontal"
|
||||
:class "workspace-buttons"
|
||||
|
||||
(button :onclick "riverctl set-focused-tags 1" :class "workspace-button ${ws1}" (label :text "1"))
|
||||
(button :onclick "riverctl set-focused-tags 1" :class "workspace-button ${if river_tag == \"1\" {\"ws-current\"} {\"ws-empty\"}}" (label :text "1"))
|
||||
(label :text " ")
|
||||
(button :onclick "riverctl set-focused-tags 2" :class "workspace-button ${ws2}" (label :text "2"))
|
||||
(label :text " ")
|
||||
@@ -232,7 +242,7 @@
|
||||
(label :text " ")
|
||||
(button :onclick "riverctl set-focused-tags 6" :class "workspace-button ${ws6}" (label :text "6"))
|
||||
(label :text " ")
|
||||
(button :onclick "riverctl set-focused-tags 7" :class "workspace-button ${ws7}" (label :text "7"))
|
||||
(button :onclick "riverctl set-focused-tags 7" :class "workspace-button {if river_tag == \"1\" {\"ws-current\"} {\"ws-empty\"}}" (label :text "s"))
|
||||
(label :text " ")
|
||||
(button :onclick "riverctl set-focused-tags 8" :class "workspace-button ${ws8}" (label :text "8"))
|
||||
(label :text " ")
|
||||
@@ -241,11 +251,11 @@
|
||||
|
||||
(defwidget widgetWindows []
|
||||
(label
|
||||
:text "${windows}"))
|
||||
:text "${river_title}"))
|
||||
|
||||
(defwidget widgetLayouts []
|
||||
(label
|
||||
:text "${layouts}"))
|
||||
:text "${river_layout}"))
|
||||
|
||||
(defwidget widgetLogSeperator []
|
||||
(label
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
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
|
||||
@@ -1,32 +1,35 @@
|
||||
TEMP_FILE="/tmp/river-eww-status"
|
||||
layout=$(ristate -l 2>/dev/null | jq -r '.layout // ""')
|
||||
title=$(ristate -w 2>/dev/null | jq -r '.title // ""')
|
||||
tags_json=$(ristate -t 2>/dev/null)
|
||||
views_json=$(ristate -vt 2>/dev/null)
|
||||
|
||||
# Read last two lines (layout/tags and focused window)
|
||||
json=$(tail -n2 "$TEMP_FILE" | head -n1)
|
||||
win_json=$(tail -n1 "$TEMP_FILE")
|
||||
mapfile -t focused_tags < <(
|
||||
printf '%s\n' "$views_json" |
|
||||
jq -r '.viewstag.Unknown // [] | .[] | tostring'
|
||||
)
|
||||
|
||||
# Extract layout
|
||||
layout=$(echo "$json" | jq -r '.layout // ""')
|
||||
if [ "${#focused_tags[@]}" -eq 0 ]; then
|
||||
mapfile -t focused_tags < <(
|
||||
printf '%s\n' "$tags_json" |
|
||||
jq -r '.tags.Unknown // [] | .[] | tostring'
|
||||
)
|
||||
fi
|
||||
|
||||
# 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"
|
||||
echo "$tag - current"
|
||||
break
|
||||
fi
|
||||
done
|
||||
eww update ws$i="$class"
|
||||
eww update "ws$i=$class"
|
||||
done
|
||||
|
||||
# Update layout
|
||||
eww update layouts="$layout"
|
||||
|
||||
# Output focused window for widget
|
||||
eww update "layouts=$layout"
|
||||
echo "$layouts"
|
||||
eww update "windows=$title"
|
||||
echo "$windows"
|
||||
|
||||
echo "$title"
|
||||
|
||||
Reference in New Issue
Block a user