Gopher Menu

       ----------------------------------------
       Google Calendar -> calcurse synchronise one way without CalDAV/OAuth2
       January 24th, 2019
       ----------------------------------------
       
       calcurse is a nice ncurses calendar, appointment and to-do program for 
       terminal use... It includes an extremely clunky ALPHA software called 
       calcurse-caldav to synchronise with CalDAV servers or Google Calendar 
       (using OAuth2 Authentication).
       
       If, like myself, you have ever used calcurse with Google Calendar, you 
       may have noticed that calcurse-caldav is indeed alpha software, and 
       should probably be avoided by all but the most hardcore users and 
       developers... Fortunately in my case I've found a workaround that suits 
       me, as I only need to synchronise one-way, from Google to my local 
       machine. The workaround is simple: many calendars on Google Calendars 
       have publicly-available addresses in iCal format and some have secret 
       addresses in iCal format... You can find them by going to 
       calendar.google.com, click the hamburger (why isn't it a cheeseburger?) 
       menu at the top-left so that "My calendars" and "Other calendars" are 
       displayed in the bar on the left. Hover over a calendar you are 
       interested in and hit the three-dot menu and then "Settings and sharing".
       The URLs (if available) will be in the "Integrate calendar section" and 
       labeled as "Public address in iCal format" and/or "Secret address in iCal
       format".
       
       I was able to import my personal calendar, and some holiday calendars 
       that I follow (en.christian#holiday, en.philippines#holiday, 
       en-gb.usa#holiday, and en.islamic#holiday).  I could not pull-in 
       #contacts (birthdays and anniversary dates from Google Contacts, and some
       weird legacy crap from Google+ which nobody cares about) and family.
       
       The way I get calcurse to do what I want is via a simple function in my 
       shell which does the following: sets the windows title (if I'm running in
       tmux or some kind of graphical terminal emuilator {xterm}), sets 
       appropriate file permissions (I don't have anything secret, but I do want
       any other users to have to work to snoop on my files, haha!), nukes 
       almost everything on startup (this is important, because calcurse import
       can't tell if an event is a duplicate, and they can pile up rather 
       quickly), downloads the iCal files from Google, imports the iCal files,
       and finally actually runs calcurse.
       I had to set ~/calcurse/apts and ~/calcurse/notes/ to symlink to a tmp
       directory.
       
       Here's what I came up with in the end:
       
       calcurse() {
       echo -ne '\033k'calcurse'\033\\'
       umask 027
       rm -rf /tmp/calcurse-zachary/
       mkdir -p /tmp/calcurse-zachary/notes
       wget -q https://SECRETURL /tmp/calcurse-zachary/zach.ics
       wget -q http://bit.ly/2FKrneX -O /tmp/calcurse-zachary/christian_holidays
       wget -q http://bit.ly2WeQgnO -O /tmp/calcurse-zachary/philippine_holidays
       wget -q http://bit.ly/2FNXryq -O /tmp/calcurse-zachary/us_holidays.ics
       wget -q http://bit.ly/2RIx0As -O /tmp/calcurse-zachary/islamic_holidays
       /usr/bin/calcurse -qi /tmp/calcurse-zachary/zach.ics
       /usr/bin/calcurse -qi /tmp/calcurse-zachary/christian_holidays
       /usr/bin/calcurse -qi /tmp/calcurse-zachary/philippine_holidays
       /usr/bin/calcurse -qi /tmp/calcurse-zachary/us_holidays.ics
       /usr/bin/calcurse -qi /tmp/calcurse-zachary/islamic_holidays
       /usr/bin/calcurse $@
       echo -ne '\033k'sh'\033\\'
       }
       
       
       
       That shell function will refresh calcurse whenever I open it.... If I 
       leave it open for days and need an update, I just close it and then open 
       it again. Easy.
       ----------------------------------------
 (DIR) Back to phlog index
 (DIR) gopher.zcrayfish.soy gopher root
       This phlog entry has been read 506 times.
       Future comments have been disabled for this post
       There are no comments for this post