My Google CLI Workflow: From Terminal to Phone in Perfect Sync
You know that feeling when you discover a workflow that just clicks? That’s exactly what happened when I built my Google CLI automation system. As a 27-year-old engineering student who absolutely loves automating everything (thanks to my time as a Network Engineer at Digicel), I’ve created a seamless bridge between my terminal and my phone’s Google Calendar widget.
Why I Built This
Let me paint the picture: I’m deep in my IDE, working on some networking assignment for Eurecom, when I remember I need to schedule a call with my project partner. The old me would:
- Alt+Tab to browser
- Navigate to Google Calendar
- Create the event
- Tab back to terminal
- Lose my train of thought π
The new me? I just type:
./agenda.py add "Project sync call" "14:30" 1
And boom! Event created, synced to my phone instantly, and I never left my terminal. This is the kind of automation that network engineering taught me to love.
The Complete System
My setup consists of three main Python scripts that work together like a well-orchestrated network:
π agenda.py - Calendar Management
This is my main calendar interface. It connects to both my personal calendar and my imported Eurecom school calendar.
Quick event creation:
# Meeting today at 2:30 PM
./agenda.py add "Team standup" "14:30"
# Dentist appointment tomorrow at 10 AM
./agenda.py add "Dentist" "10:00" 1
# Project deadline next week with custom end time
./agenda.py add "Final presentation" "09:00" 7 --end_datetime 2024-12-15T11:00
Smart agenda viewing:
# Next 7 days (default)
./agenda.py list
# Just tomorrow's schedule
./agenda.py list 1
# Full week ahead
./agenda.py list 7
The output is clean and actually useful:
π
Events in next 7 day(s):
β’ Today 14:30 β Team standup
β’ Tomorrow 10:00 β Dentist
β’ 2024-12-15 09:00 β Final presentation
β tasks.py - Task Management
This one’s my favorite because it sorts tasks intelligently - exactly how my brain works:
# Add tasks with smart due dates
./tasks.py add "Finish network security assignment" 0 23:59 # Due today
./tasks.py add "Buy groceries" 1 18:00 # Tomorrow evening
./tasks.py add "Call mom" 3 # In 3 days, no specific time
# List shows them prioritized
./tasks.py list
The color coding is chef’s kiss:
- Red: Due today (panic mode π )
- Green: Due tomorrow (manageable)
- White: Due later (chill)
Tasks due today get the red treatment because, let’s be honest, those are the ones that matter right now.
π± convert.sh - Currency Converter
Living between France and Jamaica means constantly converting currencies. Plus, as a curious tech student, I track some crypto:
./convert.sh usd jmd 100 # Quick USD to JMD
./convert.sh btc usd 1 # Check Bitcoin price
./convert.sh eth jmd 0.5 # Ethereum to Jamaican dollars
This integrates beautifully with my Linux setup - I have the output piping to my WayBar, so current rates are always visible in my system bar.
The Magic: Google APIs Integration
Here’s where my network engineering background really shines. The authentication flow is robust with proper token refresh handling:
def get_service():
creds = None
if os.path.exists(TOKEN_PATH):
with open(TOKEN_PATH, 'rb') as token:
creds = pickle.load(token)
if not creds or not creds.valid:
try:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
raise RefreshError("Trigger reauth")
except RefreshError:
# Graceful re-authentication
flow = InstalledAppFlow.from_client_secrets_file(CREDENTIALS_PATH, SCOPES)
creds = flow.run_local_server(port=0)
This handles token expiration gracefully - something I learned is crucial when working with network systems that need to be reliable.
Phone Integration: The Real Game Changer
The best part? Everything syncs instantly to my phone’s Google Calendar widget. I add an event in terminal, and within seconds it’s visible on my phone’s home screen. No app opening, no manual sync - just there.
[Screenshot of phone widget showing terminal-created events]
This bi-directional sync means I can:
- Create events on terminal β See on phone instantly
- Add quick events on phone β Pull into terminal view
- Modify events anywhere β Everything stays synchronized
Linux Integration: Making It Seamless
Being a Linux enthusiast, I’ve integrated this into my daily workflow:
Bash aliases in ~/.bashrc:
alias agenda='~/dev/scripts/agenda.py list'
alias tomorrow='~/dev/scripts/agenda.py list 1'
alias tasks='~/dev/scripts/tasks.py list'
alias add-task='~/dev/scripts/tasks.py add'
alias add-event='~/dev/scripts/agenda.py add'
WayBar integration for system tray info:
"custom/calendar": {
"exec": "~/dev/scripts/agenda.py list 1 | head -1",
"interval": 300,
"format": "π
{}"
}
Smart Features I’m Proud Of
Multi-Calendar Support
The system automatically checks both my personal calendar and my Eurecom school calendar:
for calendar_id in (
"primary",
os.getenv("SCHOOL_CALENDAR_ID", "2v5ivo6m0b3bko8oedcjr5i36orv3lpl@import.calendar.google.com")
):
# Fetch events from both calendars
Intelligent Task Sorting
Tasks aren’t just chronological - they’re sorted by urgency:
def sort_key(task):
due_str = task.get('due')
if due_str:
due_date = datetime.date.fromisoformat(due_str[:10])
if due_date == datetime.date.today():
return (0, due_str) # Highest priority
elif due_date == datetime.date.today() + datetime.timedelta(days=1):
return (1, due_str) # Second priority
else:
return (2, due_str) # Later
else:
return (3, '') # No due date = lowest priority
Timezone Intelligence
Everything respects local timezone automatically using tzlocal
- crucial when coordinating with teammates across different time zones.
The Network Engineer Touch
My Digicel background shows in how I designed this:
- Robust error handling - Networks fail, APIs timeout, tokens expire
- Logging everything - Every operation goes to
logs.log
with timestamps - Modular design - Each script does one thing well
- Environment configuration - All sensitive data in
.env
files - Graceful degradation - If one service fails, others keep working
Productivity Impact
Since building this system:
- 50% faster event creation (no context switching)
- Zero missed appointments (everything’s in my face on the phone widget)
- Better task prioritization (color-coded urgency actually works)
- Seamless mobile-desktop sync (the dream workflow!)
Future Enhancements
As a curious student always tinkering:
- Natural language parsing: “Schedule lunch with Sarah next Tuesday”
- Integration with my study schedule: Auto-block study time based on assignment due dates
- Smart conflict detection: Warn before double-booking
- Meeting link generation: Auto-add Google Meet links for video calls
The Source Code
The beauty of this system is its simplicity. Three Python files, some bash scripts, and a .env
config. No fancy frameworks, no over-engineering - just clean, maintainable code that solves a real problem.
Key files:
agenda.py
- 132 lines of Google Calendar magictasks.py
- 176 lines of smart task managementconvert.sh
- Currency conversion for my international lifeworkflows.sh
- Automated document backup system
Why This Matters
This isn’t just about productivity tools - it’s about creating systems that enhance how you work without getting in the way. As someone studying telecommunications and networks, I’m fascinated by how small automations can create big workflow improvements.
The real magic happens when technology becomes invisible. I don’t think about “using a calendar app” anymore - I just schedule things and they appear everywhere I need them.
Try It Yourself
If you’re a terminal dweller like me, the source is available on my GitHub. The setup takes about 10 minutes, and the productivity gains are immediate.
The best part? Once it’s running, you forget it exists until you try to use someone else’s computer and wonder why everything feels so clunky. π
What automations have transformed your workflow? I’m always curious about how other engineers optimize their daily systems.