From: Samir Benmendil Date: Mon, 2 Jul 2018 08:49:24 +0000 (+0100) Subject: mutt: show iCal entries in mutt X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/68e6a1194080e79c23608ff55f2c7fa054f3c6fc?ds=inline mutt: show iCal entries in mutt --- diff --git a/mutt/ical2txt b/mutt/ical2txt new file mode 100755 index 0000000..5b7c998 --- /dev/null +++ b/mutt/ical2txt @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +from icalendar import Calendar + +def format_cal(start, end, description): + str = "Start: {:%Y-%m-%d %H:%M}\n".format(start) + str += "End: {:%Y-%m-%d %H:%M}\n\n".format(end) + if description is not None: + str += description + + return str + + +with open('/dev/stdin', 'r') as f: + cal = Calendar.from_ical(f.read()) + +for c in cal.walk(): + if c.name == "VEVENT": + print(format_cal( + c.get('dtstart').dt, + c.get('dtend').dt, + c.get('description'))) diff --git a/mutt/mailcap b/mutt/mailcap index 52c4d1c..6eb7391 100644 --- a/mutt/mailcap +++ b/mutt/mailcap @@ -1,4 +1,5 @@ text/html; $XDG_CONFIG_HOME/mutt/mutt_bgrun qutebrowser %s; test=test -n "$DISPLAY"; nametemplate=%s.html text/html; w3m -I %{charset} -dump %s -T text/html -cols "$COLUMNS" -o display_link_number=1; copiousoutput; nametemplate=%s.html +text/calendar; $XDG_CONFIG_HOME/mutt/ical2txt; copiousoutput application/*; $XDG_CONFIG_HOME/mutt/mutt_bgrun rifle -f F %s; image/*; rifle -f F %s;