Open
Conversation
Info.plistのcom.apple.inputmethod.RomanにtsInputModeKeyEquivalentModifiersKey /Keyを追加し、Google日本語入力と同じCtrl+Shift+;で英語入力に切り替えられる ようにする。日本語モード側のCtrl+Shift+Jと対になるショートカット。 Closes #313 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
日本語モードのtsInputModeKeyEquivalentKeyが"J"(shift+jの結果)であるのに 合わせて、英語モードも";"から":"(shift+;の結果)に修正。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
macOSのsmJapanese scriptにはCtrl+Shift+Jが自動割り当てされているが、 smRoman scriptには同様の自動割り当てがないため、Info.plistでの tsInputModeKeyEquivalent設定だけでは英語モードへの切り替えが効かない。 azooKeyMacInputController.handle(_:client:)内でkeyCode 41(; キー)と Ctrl+Shiftの組み合わせを検出し、明示的にswitchInputLanguage(.english)を 呼び出す形で対処する。JIS/ANSIキーボードいずれでも物理キー位置で動作する。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
smRoman scriptには macOS 側にショートカット自動割り当ての仕組みが なく、Info.plistで宣言してもショートカットが有効にならないことを 実機で確認したため削除する。英語モードへの切り替えは azooKeyMacInputController.handle(_:client:) 内の自前実装で行う。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
私はUS配列なので |
Member
Contributor
Member
|
@amatsus なるほど、理解です!とはいえ、実装方法はinfo.plistを変更するほうが妥当だと思うので、そっちにしたいです。 @nyanko3141592 |
Contributor
|
ですかね。 |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Ctrl+Shift+;で azooKey英語モードに切り替えられるようにしたCtrl+Shift+J(macOSがsmJapanese scriptに自動割り当て)と対になるショートカットCloses #313
実装の経緯
最初は
Info.plistのcom.apple.inputmethod.RomanにtsInputModeKeyEquivalentModifiersKey/tsInputModeKeyEquivalentKeyを追加する方針で試したが、実機で動作しないことを確認した。原因はmacOSの仕様で、smJapanesescriptのプライマリIMEにはCtrl+Shift+Jが自動割り当てされる一方、smRomanscriptには同様の自動割り当てがないため、Info.plistでショートカットを宣言してもOSに拾われない。そこで
azooKeyMacInputController.handle(_:client:)内で直接ショートカットをキャッチする方針に変更した。Info.plistの実験的な変更は結局効果がなかったため最終的に差し戻している(コミット履歴には残っている)。変更内容
azooKeyMac/InputController/azooKeyMacInputController.swift:handle()の早い段階でkeyCode 41(;キーの物理位置)+ Ctrl+Shift を検出し、switchInputLanguage(.english)を呼ぶ処理を追加。変換中のマークドテキストがある場合は確定してから切り替える挙動
keyCodeベースで判定しているため、JIS/ANSIいずれのキーボードでも物理キー位置(USでの
;位置)で動作する。Test plan
Ctrl+Shift+;を押して英語モードに切り替わることをローカル実機で確認Ctrl+Shift+Jによる日本語モード復帰動作に影響がないことを確認Ctrl+Shift+;を押した場合、マークドテキストが確定されて英語モードに切り替わることを確認