Never miss a google meet with systemd
I don’t like to be late at meetings, and I relied heavily on my coworkers to warn me about a meeting starting.
Now, I’m working in a fully remote company, and I can’t rely on my coworkers, because they can only message me, and I don’t look at slack/emails all day.
So I came up with 1 little script (and 2 systemd units) to automatically launch my meeting 1-2 minutes before it actually starts.
The script relies on gcalcli:
- it checks the next meeting I accepted
- it retrieves the Google Meet URL
- it launches a new Google Chrome windows.
~/.local/bin/auto-google-meet
#!/bin/bash
set -eufo pipefail
EMAIL_ADDRESS='your@email.com'
BACKUP_FILE=.previous-meetup
touch "${BACKUP_FILE}"
PREVIOUS_MEETUP=$(cat "${BACKUP_FILE}")
NEW_MEETUP=$(gcalcli --calendar="${EMAIL_ADDRESS}" agenda --details url --tsv --nodeclined "$(date --date="+1 minutes" +"%Y-%m-%dT%H:%M")" "$(date --date="+3 minutes" +"%Y-%m-%dT%H:%M")" | cut -d$'\t' -f6)
if [ "$NEW_MEETUP" != "$PREVIOUS_MEETUP" ]; then
if [ "$NEW_MEETUP" != "" ]; then
export DISPLAY=:0
nohup google-chrome --new-window "${NEW_MEETUP}" &
fi
fi
echo "${NEW_MEETUP}" > "${BACKUP_FILE}"
The next step is to have one systemd user service:
~/.config/systemd/user/auto-google-meet.service
and a systemd timer:
~/.config/systemd/user/auto-google-meet.timer
Don’t forget to enable the timer and the service:
systemctl --user enable auto-google-meet.timer
systemctl --user enable auto-google-meet.service
and voilà! you’ll never miss a google meet now.