In this blog, I'm going to share a script you can use to change your Zoom background straight from your command line.
Context
So, I work remote at this company, and part of our work culture is that we set special Zoom backgrounds for birthdays, work anniversaries, and other special events. Here's an example from 2024:
Now, I might possibly be the only person in the world who is impatient enough to feel this, but I hate having to go into Zoom to manually upload and change my custom background.
You have to go into your settings for virtual backgrounds, THEN click on the option to upload an image, THEN fumble around in finder to grab the right image to upload to Zoom.
My Preferred Solution
Instead of doing it manually, I wrote a script in bash that would automate this manual work for you. Here is the script:
#!/bin/bash
ZOOMPATH={{zoom_path}}
UUID=$(find "{{zoom_path}}" -type f -not -name ".*" | head -n1 | awk -F: '{print $1}')
RECENTFILE=$(find "{{downloads_path}}" -type f -exec stat -f "%m %N" {} \; | sort -rn | head -n1 | awk -F/ '{print $NF}')
BGPATH="{{downloads_path}}/$RECENTFILE"
echo "Moving $BGPATH to $UUID"
cp -R "$BGPATH" "$UUID"
This script is basically taking your most recently downloaded file and replacing whatever default virtual background you have in Zoom with that downloaded file.
Your downloads_path
is most likely something like /Users/<your_username>/Downloads
or $HOME/Downloads
, but I trust you'll be able to find that path yourself if you moved around your Downloads folder.
Your zoom_path
can be found by running mdfind -name "VirtualBkgnd_Custom"
. If it helps, my path was $HOME/Library/Application Support/zoom.us/data/VirtualBkgnd_Custom
. When you run the command, you'll get an output that looks something like this:
Making It Even Easier
After writing the script, I wanted to:
Save this script somewhere so I didn't have to rewrite it every time.
Make this widely accessible for the rest of my team so they could enjoy this automation as well.
To do this, I created a new workflow in my Warp terminal and pasted in my script and pressed autofill. For those of you who aren't familiar, workflows are kind of like aliases that you have in your shell config (.zshrc file, for example) in the sense that it gives you a way to quickly run complex & hard-to-remember commands. I like workflows slightly better because I can share the workflow with my team (if I prefer) and it also auto-parameterizes my command/script so I can vary things like paths, secrets, or more.
If you're curious about the terminal I'm referring to above, Warp is a Rust-based terminal with AI built in. I like it because it has things like autocompletions, history search, click-to-edit, and theming out-of-the-box. Feels super modern compared to the default Mac terminal or iTerm2. And if you do want to try it out, use my referral link & get a free theme. (I work there.)
Conclusion
And finally, if you want to see 1-minute demo of this Zoom-background-changing-script in action, you can check this Loom out. Thanks for reading!
Top comments (3)
OMG. This is so cool! Thanks for sharing!
Glad you found this interesting :)
That’s pretty awesome!!