Using AI to build a simple productivity app for personal use in under 30* minutes

PROBLEM STATEMENT
While working on my Laptop, I realized that I often get distracted and switch to non-work related apps or browser tabs, which causes a context switch. I wanted to keep track of how many times and how often this happens. I know there are sophisticated apps that can track this at a granular level, even noting which app is used and for how long, but that wasn't my intention. I simply wanted to track how many times I switch context, so I decided to build an App for my Laptop using Gemini.

I started by creating a new folder and launching the Gemini CLI.

Compared to my earlier post, this time I was able to save all the actual prompts, thanks to a simple project that saves conversations locally.

THE APP (~10 MINUTES)


> create a simple mac app for personal use which I can use to track how many times in a day I switch context away from my focussed work. It should be something which runs in the status bar or system tray and I can click on it whenever I feel I have switched context. The counter should keep increasing. Every day should start with counter at 0. Save this data locally. Show an option with bar graph of daily context switching counts.

It automatically chose Swift and SwiftUI (for Mac), status bar icon and a local JSON file to store the daily counts.

It kept talking to itself, apologized for certain things beyond my control, resolved a few errors. It ran the app and lo and behold I could see the first version running! My next prompt was a request for another feature and an issue related to the chart.


> allow me to clear existing data since there might be some data logged during testing. also viewing chart is not working

(Gemini) ✦ Okay, I'll add a "Clear Data" menu item that calls a new DataStore function to delete the data file... (some more)

Then I realized that I might accidentally click on the 'Clear data' option and it would wipe out the day's stats. So...


> prevent clear data from accidentally getting triggered, add a confirmation dialog

✦ Okay, I'll add a confirmation dialog before clearing data... (some more)


> it will also be cool to track the time taken between each 'context clicks' (ignoring the first one of the day since that would mean overnight 
  sleep). What would you suggest? Would it be a single average time that we keep updating or some sort of a graph?

✦ That's an excellent idea for adding more depth to the app. I would suggest a bar graph over a single average. A simple average can be easily skewed by long breaks (like lunch or meetings), while a graph showing the distribution of time between context switches will provide a much richer and more accurate insight into your work patterns.

It took a few more prompts to fix some bugs and fine tune it a bit.
Now, my itch was scratched and it was time for me to know how to run the app on my own.

> how to run this app?
It listed couple of options. I just told it to create a final release build.

The app running in my system tray



A nice little counter in the system tray

Bar chart after some test runs



ICON (~15 MINUTES)

I spent the most amount of time here! Not only did I want a new icon, but it also had to be told to use the icon for the Finder/Launcher app.
Like earlier, it still does not generate images. So I asked it to write a prompt and I fed it to Gemini Web.

> write a prompt which will help to generate a icon

Time was also spent in creating png image files, and then converting it to icon files for Mac etc.

The final icon as seen in my Finder



CLOSING (~5 MINUTES)

In the closing stages, I had to ask for steps to prepare the app so that it is easy to launch. Also had to ask it to create and commit the changes to a local repository.

The core app was built in roughly 30 minutes!

WASTE OF TIME (~45 MINUTES)

After this, I did end up spending more time trying to get the best icon and realizing that there are limits to what sort of a icon can be displayed in the Status bar. And then even more time fixing icon related bugs, none of which were related to the core functionality!

Overall, not a bad way to create a simple app for personal use!

Gemini CLI showing some cool stats of the conversation

PS: 90% of the content in this blog was written by a human. I also asked the AI to write a blog post based on the logged conversation and this is what it came up with!

Comments

Popular posts from this blog

CTO by chance! Short story of Amazon CTO Werner Vogels

How (A)I built a simple Flutter app over a weekend with zero manual code!

How love for his musician brother got Ragunathan Pattabiraman started on his entrepreneurship journey!