Reverse Engineering an Apple Shortcut and Making It Mine

@ewancroft.uk

Bluesky has opened up some fascinating possibilities in the realm of automation. A while back, I was inspired by a brilliant blog post by dame.is about creating a dynamic avatar using an Apple Shortcut. I thought, “Why not make it mine?” So, I rolled up my sleeves, hyperfocused, and dived into Python, and now I have two projects that work in tandem (or independently) to keep my profile fresh every hour.

Why Did I Create This?

A few days ago, I noticed dame's avatar changing hourly based on the time relative to their time zone, and I was eager to try it for myself. I grabbed the Apple Shortcut they provided as a template, but my initial foray with Apple Shortcuts hit a few snags—it just wasn’t working out smoothly. I needed more control and flexibility, so I decided to recreate the process in Python, which offered the freedom to build a truly adaptable script.

The Two Pillars of the Project

1. The Sky Colour Gradient Image Generator

Available on GitHub, this script is the creative heart of the operation. I set up a JSON configuration that maps each hour of the day to a specific sky colour, and the script uses linear interpolation to blend these colours into a smooth gradient that evolves as the day progresses. Once the background is generated, it overlays text (like my name) using a chosen font, carefully calculating the optimal font size and placement to ensure the text appears balanced no matter the image dimensions. I began with the standard 400x400 profile image, as that was the initial inspiration, and then expanded to the 1500x500 banner sizing and then offering the option for custom dimensions later on.

2. The Bluesky Avatar Updater

The second component, which you can also find on GitHub, brings a seamless level of automation to my Bluesky profile. This script runs on a cron job every hour, checking a JSON file that maps hours to image content identifiers to select the right avatar (and banner, if needed). I quickly learned that updating the avatar without preserving other profile details could be problematic, so the script first retrieves the current profile information before only updating the avatar (and banner, if applicable). This approach ensures that crucial details like my display name and bio remain intact. With some added error handling and necessary package imports, the script logs into my Bluesky account, updates the profile, and confirms that everything goes smoothly.

How Does It All Work?

The process kicks off with the initialization and setup, where the scripts load essential configurations—including environment variables, JSON mappings for image content identifiers or sky colours, and libraries like PIL, numpy, and the AT Protocol client. The Sky Colour Gradient Image Generator then reads the current hour, interpolates the relevant sky colours, overlays the text, and saves the image.

Once the new image is ready, the Avatar Updater steps in on schedule: it selects the appropriate image for the current hour by reading the JSON file, authenticates with Bluesky, retrieves the current profile data, and pushes the updated avatar (and banner, if needed). Both scripts are equipped with detailed logging and error handling, ensuring that I am always notified if something goes awry.


Building this system has been both a technical challenge and a creative medium. It feels like, to me, an imperfect blend of art and code that captures the subtle changes of the day through my online presence. While I initially set out to fix a problematic Apple Shortcut, I ended up crafting something that is expandable, resilient, and deeply personal. I’m excited about the future possibilities and continue to love the capabilities of the AT Protocol.

ewancroft.uk
ewan

@ewancroft.uk

a mentally unstable british poet and programmer who is unreasonably into werewolves.

Post reaction in Bluesky

*To be shown as a reaction, include article link in the post or add link card

Reactions from everyone (0)