Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KeyMinder

KeyMinder is a macOS status bar utility that remembers your preferred keyboard input source (keyboard language layout) per application or per window and switches it automatically when you change focus. No more typing in the wrong language when switching between apps!


Disclaimer: I'm not really a developer. Especially not for macOS. I don't even like macOS. This product is the result of combined efforts of several LLMs with me as a judge and frustration with some default macOS functionality. I really hope it'll help other as it helped me.


✨ Features

  • 📦 Tracks input source of applications
  • 🔄 Automatically switches keyboard layout based on focus
  • 🧠 Remembers your last used input source for each app/window
  • 🌐 Simple macOS menu bar interface
  • 🔒 Secure & private: all mappings are stored in memory
  • 🛠 Runs automatically at login via LaunchAgent
  • ⚙️ No external dependencies, 100% Swift/Cocoa

🔧 Installation

Note: This app requires Accessibility permissions to function.

  1. Build the project in Xcode (macOS target).
  2. Run the app. It will prompt for Accessibility permissions.
  3. Go to System Settings > Privacy & Security > Accessibility
    • Add the app if it's not listed
    • Ensure the checkbox is enabled
  4. The KeyMinder icon will appear in your macOS menu bar.
  5. Choose your default input source.

🧪 Development & Debug

  • Logging is printed to the console (stdout)
  • Accessibility setup can be tested via the testAccessibilitySetup() function
  • maybeInstallLaunchAgent() installs a LaunchAgent plist to auto-start on login

🧠 How It Works

  • Listens to AXFocusedUIElementChangedNotification from each active app
  • Identifies the focused window or app (based on mode)
  • Checks if an input source is stored for that identifier
    • If yes → switches to it
    • If no → assigns the default input source
  • Tracks user-initiated input source changes and updates mappings

📂 Project Structure

  • AppDelegate.swift: Main app entry point, sets up menu and managers
  • InputSourceManager class: Manages keyboard input sources
  • WindowMonitor class: Tracks window/app focus changes and manages mappings

⚠️ Accessibility Permissions

KeyMinder relies on macOS Accessibility APIs to detect app/window focus. You must grant access for it to function:

  • Go to System Settings > Privacy & Security > Accessibility
  • Add your app binary manually if it's not listed
  • Enable the checkbox
  • Restart the app

🚀 Launch at Login

KeyMinder installs a LaunchAgent plist file in: ~/Library/LaunchAgents/com.alextuby.KeyMinder.plist


Known issues

This app relies on the AXFocus change which is mechanism within macOS to track which window has the focus now. This mechanism doesn't always work well. While it's reliable with "regural" app, some apps like Spotlight have these floating windows. And while the focus really changes there's no notification about it. In some other cases there's notification when this floating window gets the focus but no notification when it switches back.


License

This project is licensed under the MIT License.

Author

Oleksandr Tubolets

About

KeyMinder is a native macOS application that remembers previously set input language per-application and switches to it when switching between applications

Resources

Stars

34 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages