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.
- 📦 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
Note: This app requires Accessibility permissions to function.
- Build the project in Xcode (macOS target).
- Run the app. It will prompt for Accessibility permissions.
- Go to
System Settings > Privacy & Security > Accessibility- Add the app if it's not listed
- Ensure the checkbox is enabled
- The KeyMinder icon will appear in your macOS menu bar.
- Choose your default input source.
- Logging is printed to the console (
stdout) - Accessibility setup can be tested via the
testAccessibilitySetup()function maybeInstallLaunchAgent()installs aLaunchAgentplist to auto-start on login
- Listens to
AXFocusedUIElementChangedNotificationfrom 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
AppDelegate.swift: Main app entry point, sets up menu and managersInputSourceManager class: Manages keyboard input sourcesWindowMonitor class: Tracks window/app focus changes and manages mappings
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
KeyMinder installs a LaunchAgent plist file in:
~/Library/LaunchAgents/com.alextuby.KeyMinder.plist
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.
This project is licensed under the MIT License.
Oleksandr Tubolets