summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-09-15 13:06:13 +0300
committerThomas Voss <mail@thomasvoss.com> 2023-09-15 13:06:13 +0300
commitc164c8b7951005008ebad6b7c85b7122cdc7f688 (patch)
tree8614d2bdd661a1789b660d9e4028c02ab2f37f1b
parent7b5c1e65ed5c84f85b7257f56bdc7d3508248edd (diff)
eww: Improved usage of read(1)
-rwxr-xr-x.config/eww/scripts/workspace-list-listener13
1 files changed, 4 insertions, 9 deletions
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