summaryrefslogtreecommitdiff
path: root/.local/bin/any_position_wrapper.sh
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/any_position_wrapper.sh')
-rwxr-xr-x.local/bin/any_position_wrapper.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/.local/bin/any_position_wrapper.sh b/.local/bin/any_position_wrapper.sh
index 6aa6268..f821657 100755
--- a/.local/bin/any_position_wrapper.sh
+++ b/.local/bin/any_position_wrapper.sh
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+set -eo pipefail
# This i3status wrapper allows to add custom information in any position of the statusline
# It was developed for i3bar (JSON format)
@@ -46,10 +47,12 @@ function irdate {
json_array=$(update_holder holder__jdate "$json")
}
-i3status | (read line; echo "$line"; read line ; echo "$line" ; read line ; echo "$line" ; while true
+i3status > >(read line; echo "$line"; read line ; echo "$line" ; read line ; echo "$line" ; while true
do
read line
json_array="$(echo $line | sed -e 's/^,//')"
irdate
echo ",$json_array"
-done)
+done) & PID=$!
+trap "kill -TERM $PID" 0 1 2 15
+wait $PID