Skip to content

Instantly share code, notes, and snippets.

@teddywing
Created November 26, 2021 09:06
Show Gist options
  • Save teddywing/eb0f3416c49b5030db5fbf15d5f6eb25 to your computer and use it in GitHub Desktop.
Save teddywing/eb0f3416c49b5030db5fbf15d5f6eb25 to your computer and use it in GitHub Desktop.
Open the next videoconference meeting
#!/bin/bash
# nextmeeting
# Output a link to the next upcoming or currently ongoing meeting.
# The '-o' flag opens the meeting URL in a new Google Chrome window.
# Copyright 2021 Teddy Wing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
now="$(date +%Y-%m-%dT%H:%M:%S%z)"
meeting_url_field=6
meeting_url=$(gcalcli \
--calendar 'CALENDAR_NAME' \
agenda \
--details url \
--tsv \
"$now" \
\
| head -n 1 \
| cut -f "$meeting_url_field"
)
if [ "$1" = '-o' ]; then
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--profile-directory="Default" \
--new-window \
"$meeting_url" \
2>&1 \
> /tmp/nextmeeting-chromelog
else
echo "$meeting_url"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment