blob: d4cdd47ec79c326e5f37a4b154498307fc7aae25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/bin/bash
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
))
)"' 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$@@
' \
| tr -d '\r' \
| sed '
:a
$!N
s/\([^}]\)\s*\n/\1 /
ta
P
D
' \
| 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}@
'
|