Skip to content

Instantly share code, notes, and snippets.

@elundmark
Last active December 27, 2019 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elundmark/94c9f96d7fe8168913c52677160197ff to your computer and use it in GitHub Desktop.
Save elundmark/94c9f96d7fe8168913c52677160197ff to your computer and use it in GitHub Desktop.
Show the next 2 days calcurse meetings in i3blocks (i3bar) (Nerd Font must be installed)
#!/bin/sh
# install font from: https://www.nerdfonts.com
no_lines() {
DIV=' '
if [ "$1" != "$DIV" ] ; then
DIV="$(printf '%s' "$1" | sed 's#@#\\@#g')"
fi
sed ':a;N;$!ba;s@\n@'"$DIV"'@g'
return $?
}
calcurse \
--read-only -Q --days 2 \
--format-apt '%S ```%m``` ' \
--format-recur-apt '%S ```%m``` ' \
--format-event 'ﮮ ```%m``` ' \
--format-recur-event 'ﮮ ```%m``` ' \
--format-todo ' ```%m``` ' \
| sed -r 's@[&]@&@g' \
| sed -r 's@[<]@&lt;@g' \
| sed -r 's@[>]@&gt;@g' \
| sed -r \
-e 's@^(2[0-9]{3}-[0-1][0-9]-[0-3][0-9]):$@<span color="#FF79C6"></span> <span color="#BD93F9">\1</span>@g' \
-e 's@(([0-9]{2}:[0-9]{2} )?(ﮮ | )?)```([^`]*)``` @<span color="#8BE9FD">\1</span><span color="#FFFFFF">\4</span> @g' \
| no_lines ' ' | (
if test -e "$HOME/.working"; then
cat - | sed -r 's#(Hide|Hidden|Personal|Personligt)[:=][^<]+?#---#g'
else
cat - | sed -r 's#(Hide|Hidden|Personal|Personligt)[:=]([^<]+?)#\2#g'
fi
)
echo
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment