Inspiration

We realized that while AI models are getting smarter, using them is still dumb. To fix a single function in VS Code, we often have to highlight code, copy it (Ctrl+C), Alt-Tab to a browser, paste it into a chat interface, wait, copy the result, Alt-Tab back, and paste it.

We call this the "Alt-Tab Tax", which breaks flow and wastes time. We asked: "What if AI wasn't a destination website, but a utility layer that lived on top of every app we use?" That’s Ctrl+AI.

What it does

Ctrl+AI is a background utility for Windows that brings Google Gemini to your cursor in any application, such as Notepad, Slack, or IDEs. It has two distinct modes:

  • The Commander (Ctrl+Space): Destructive editing with safety. You select text, type a command (e.g., "Fix grammar"), and review the changes in a Diff Window. You must explicitly "Accept" the change to apply it, preventing AI hallucinations from deleting your work.
  • The Analyst (Ctrl+Alt+E): Active inquiry. Instead of changing text, you can select complex code (like a Regex or SQL query) and ask questions about it. The AI provides a read-only insight card to explain what you're looking at.

How we built it

We built the core in Python 3.10 because of its rich ecosystem for system integration.

  • The Brain: We used Google Gemini Flash (via google-generativeai) because speed is the only feature that matters for a keyboard tool; it returns responses in milliseconds.
  • The Body: We used pynput and keyboard libraries to hook into global hotkeys and manipulate the system clipboard.
  • The Face: We rejected standard tkinter for customtkinter, allowing us to build a modern, high-DPI "Glass/Card" UI.
  • Packaging: We used PyInstaller to bundle the Python environment and dependencies into a single, portable .exe file.

Challenges we ran into

  • The "Focus Trap": Early versions would try to paste the AI result while the Commander window was still open, meaning the app pasted text into itself. We engineered a precise timing sequence: Hide Window -> Force OS Focus Update -> Sleep(0.2s) -> Trigger Paste.
  • The "Sticky Alt" Bug: Implementing the Ctrl+Alt+E hotkey was difficult because the OS would see us holding Alt, causing a simulated Ctrl+C to be seen as Ctrl+Alt+C. We programmatically force-release all modifier keys before capturing the clipboard.
  • Admin Privileges: Windows blocks non-admin scripts from intercepting global hotkeys. We added a startup check using ctypes to warn the user if they weren't running with elevated privileges.

Accomplishments that we're proud of

  • The "Diff View": Most AI tools blindly overwrite your text. We built a side-by-side comparison window that builds genuine trust with the user.
  • Zero-Click UX: We tuned the focus_force() logic so that when you hit Ctrl+Space, you can start typing immediately without using the mouse.
  • It actually works: It’s not just a demo; we packaged it into an .exe that runs on Windows machines without needing Python installed.

What we learned

  • Trust over Automation: We learned that "magic" automation is less valuable than user control. Pivoting from background "Ghost Modes" to a "Human-in-the-Loop" design with the Diff View taught us that building trust through transparency is essential for utility tools.
  • Operating Systems are Defensive: Building a global tool taught us that modern operating systems treat automation as a potential threat. Solving technical hurdles like the "Sticky Alt" bug and the "Focus Trap" required a deep dive into modifier release sequences, thread-safe GUI updates, and Windows focus management.
  • The Difference Between a Script and a Product: We learned that a successful hackathon project requires a "product" mindset. Moving beyond the terminal to implement a system tray icon, a high-DPI "Glass" UI, and a standalone executable was necessary to create a tool that felt reliable and native to the OS.

What's next for Ctrl+AI

  • Local LLM Support: Adding Ollama support so users can run Llama-3 locally for complete privacy.
  • Voice Mode: Adding Whisper to allow voice commands (e.g., "Computer, explain this code").
  • Mac/Linux Port: Rewriting the clipboard/hotkey logic to support macOS accessibility APIs.

Built With

Share this project:

Updates