diff --git a/calendar-contact.org b/calendar-contact.org index 66aab32..5b912f5 100644 --- a/calendar-contact.org +++ b/calendar-contact.org @@ -21,7 +21,7 @@ conflict_resolution = "a wins" type = "caldav" url = "https://radicale.tdehaeze.xyz/tdehaeze/" username = "tdehaeze" -password = "<>" +password = "<>" [storage radicale_calendar_local] type = "filesystem" @@ -38,7 +38,7 @@ conflict_resolution = "a wins" type = "caldav" url = "https://calendar.esrf.fr/egroupware/groupdav.php/calendar" username = "dehaeze" -password = "<>" +password = "<>" [storage esrf_calendar_local] type = "filesystem" @@ -60,7 +60,7 @@ fileext = ".vcf" type = "carddav" url = "https://radicale.tdehaeze.xyz/tdehaeze/" username = "tdehaeze" -password = "<>" +password = "<>" #+END_SRC * =khal= - CLI calendar application @@ -163,3 +163,32 @@ search_in_source_files = no # skip unparsable vcard files: yes / no skip_unparsable = no #+END_SRC + +* =ics-add= - Add ICS file to Khal +:PROPERTIES: +:CUSTOM_ID: ics-add +:header-args:bash: :comments both :mkdirp yes +:header-args:bash+: :shebang "#!/usr/bin/env bash" +:header-args:bash+: :tangle-mode (identity #o555) +:header-args:bash+: :tangle ~/.local/bin/ics-add +:END: + +This function is useful to easily add an event to =khal=. +It is for instance used in the =mutt= configuration. + +To share an event by email, the currently best way to proceed is to first find the event on =khal=, press =e= to export it to a file, and then add this file as an attachment. + +#+begin_src bash +if [[ -f $1 ]]; then + resp=$(echo -e "yes\nno" | rofi -i -only-match -dmenu -p "Would you like to add the event:" -mesg "`khal printics $1 | tail -n +2`") + + if [[ "$resp" == "yes" ]]; then + calendar=$(echo "`khal printcalendars`" | rofi -i -only-match -dmenu -p "Save to:") + if [ -z "$calendar" ]; then + exit; + fi + khal import -a "$calendar" --batch $1 && \ + dunstify "Calendar" "Even added"; + fi +fi +#+end_src