Developing a Windows Theme Auto-Switcher with Claude: An AI Pair Programming Journey

Recently, I decided to create a Windows application that would automatically switch between light and dark themes based on sunrise and sunset times. Instead of tackling this project alone, I worked with Claude 3.5 Sonnet as my pair programming partner. Here’s how that experience went.

The Initial Concept

My goal was simple: create a Windows app that would switch my system’s theme based on the time of day. I wanted it to run in the background and be easily configurable through a system tray icon. While I had experience with Go, I wasn’t entirely familiar with Windows services and system tray applications.

Starting with the Core Functionality

Claude helped me lay out the basic structure of a Windows service in Go. We started with a daemon that could:

  • Get the user’s location using a geolocation API
  • Fetch sunrise/sunset times
  • Modify the Windows registry to change themes
  • Handle full-screen application detection to prevent disrupting games or videos

One interesting challenge we encountered was a Windows bug where changing themes would reset cursor settings. Claude helped implement a solution that preserved and restored cursor settings after theme changes.

Evolution of the Architecture

The project went through several architectural iterations. Initially, we had the service as the main executable with a separate GUI control panel. However, after discussion, we inverted this structure to make the GUI the main entry point that would manage the service. This made more sense from a user experience perspective.

Dealing with Windows Services

Working with Windows services proved trickier than expected. We needed to:

  • Handle proper service installation and removal
  • Manage administrator privileges
  • Implement proper logging
  • Handle service status monitoring

Claude was particularly helpful in explaining Windows-specific concepts and helping debug issues with service management.

Building the User Interface

For the GUI, we implemented:

  • A system tray icon for quick access
  • A settings window for manual theme control
  • Service status monitoring
  • Installation and removal capabilities

We used the walk library for the Windows GUI components and systray for the system tray integration.

Build System Adventures

The build system went through several iterations:

  1. Started with simple Go build commands
  2. Moved to a Makefile
  3. Finally settled on Meson for a more robust build system

Getting Meson to properly handle Go builds with the right working directories and output paths took some trial and error, but we eventually got it working smoothly.

Lessons Learned

Working with Claude as a pair programming partner was an interesting experience. Some key takeaways:

  1. Claude excelled at:
    • Explaining Windows-specific concepts
    • Suggesting architectural improvements
    • Debugging build issues
    • Providing complete, working code examples
  2. Areas where human oversight was crucial:
    • Making architectural decisions
    • Catching subtle Windows-specific behavior
    • Validating the actual user experience

Conclusion

The end result is a functional Windows theme auto-switcher that runs as a service but is easily controlled through a GUI. While Claude couldn’t replace human decision-making, it proved to be an invaluable programming partner, especially when dealing with Windows-specific APIs and architectural patterns.

The source code for this project is available on GitHub [link], demonstrating a practical example of human-AI pair programming.

Have you worked with AI assistants on programming projects? Share your experiences in the comments below.

Leave a Smart Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.