Claude Code builds a macOS app that switches input with the left and right ⌘ keys
The author built a small macOS menu bar app that switches input sources with a single press of a ⌘ key: the left ⌘ switches to 英数 and the right ⌘ switches to かな. Claude Code wrote all the code in one main.swift file of just under 300 lines, with no external dependencies, no network access and no settings screen, while the author planned the work, reviewed it and checked it on real hardware. The app watches keys through an event tap[1] created with .listenOnly, so it does not change the original events, and when it detects a lone ⌘ press it sends the 英数 or かな key event.
The biggest problems were with permissions. Under ad-hoc signing[2], the signature changed with each build and macOS asked for permissions again every time, so the author signed the app with a self-signed certificate instead. The menu kept showing the permission as not granted for 12 minutes after accessibility was allowed, even though the TCC[3] database already had it; switching to AXIsProcessTrusted() fixed the display without a restart. To start at login, the app is registered as a LaunchAgent[4], so permissions are recorded under its Bundle ID.
The app does not switch input in password fields, such as in Chrome, and it was tested only on macOS 27.2.1 with Apple silicon. The work took about 2–3 hours, and the source is released under the MIT license.
Links from the post and discussion
- Source code of the app (MIT license) github.com
Sources
-
JPZenn JA
左右の⌘で英数・かなを切り替える macOS アプリを Claude Code に作ってもらった



