From c164c8b7951005008ebad6b7c85b7122cdc7f688 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 15 Sep 2023 13:06:13 +0300 Subject: eww: Improved usage of read(1) --- .config/eww/scripts/workspace-list-listener | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to '.config') diff --git a/.config/eww/scripts/workspace-list-listener b/.config/eww/scripts/workspace-list-listener index eb36f8c..d9ac666 100755 --- a/.config/eww/scripts/workspace-list-listener +++ b/.config/eww/scripts/workspace-list-listener @@ -7,19 +7,14 @@ jo -a $spaces socat -u UNIX-CONNECT:"$IPC" - \ | stdbuf -oL grep -E '^(create|destroy)workspace>>' \ - | while IFS= read -r line + | while IFS='>>' read -r e _ n do - oifs="$IFS" - IFS='>>' - set -- $line - IFS="$oifs" - - case "$1" in + case "$e" in c*) - spaces="`printf '%s\n%s\n' "$spaces" $3 | sort -V`" + spaces="`printf '%s\n%s\n' "$spaces" $n | sort -V`" ;; d*) - spaces="`echo "$spaces" | grep -v "^$3$"`" + spaces="`echo "$spaces" | grep -v "^$n$"`" ;; esac jo -a $spaces -- cgit v1.2.3