summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkhal-list27
1 files changed, 25 insertions, 2 deletions
diff --git a/khal-list b/khal-list
index d662ba2..d4cdd47 100755
--- a/khal-list
+++ b/khal-list
@@ -2,14 +2,19 @@
date_format='%F %H:%M'
+tmp_dir=$(mktemp -d)
+trap 'rm -rf --one-file-system "${tmp_dir:?}"' EXIT
+
script -qefc '/usr/bin/khal list '"$(
date +"${date_format}"
)"' '"$(
date +"${date_format}" -d@$((
$(date +%s)+6*24*60*60
))
-)" /dev/null </dev/null \
-| /usr/src/skripte/ansi-color-to-conky-color/ansi-color-to-conky-color "$@" \
+)"' 2>'"${tmp_dir}"'/stderr >'"${tmp_dir}"'/stdout' /dev/null </dev/null
+
+/usr/src/skripte/ansi-color-to-conky-color/ansi-color-to-conky-color "$@" \
+< "${tmp_dir}/stdout" \
| sed '
s@\xe2\x9f\xb3@@g
s@\r$@@
@@ -26,3 +31,21 @@ script -qefc '/usr/bin/khal list '"$(
| sed '
s/\(\(^\|}\)[^{}]\{47\}\)[^{}]\+\${/\1...${/
'
+
+sed '
+ s@^\(.\{47\}\)....*$@\1...@
+ s@#@\\#@g
+' "${tmp_dir}/stderr" \
+| tac \
+| sed -n '
+ $ {
+ p
+ d
+ }
+ 1,3 p
+' \
+| tac \
+| sed '
+ 1 s@^@${color red}@
+ $ s@$@${color}@
+'