输入法 (IMKit) 设置问题

发布于 2024-12-28 10:59:16 字数 948 浏览 4 评论 0原文

我正在尝试使用 Input 创建新的输入法方法套件。文档非常缺乏,但我相信我正确设置了项目,并且在构建后将输入法放入 ~/Library/InputMethods 中。但是,在查看“语言和语言”中的输入源列表时,我看到了奇怪的行为。文本偏好。

NumberInput 示例似乎对我来说工作得很好,除了 tsInputMethodIconFileKeyInputMethodConnectionName的值之外,我发现我的新输入法没有任何差异。 Info.plist 中的 >InputMethodServerControllerClassCFBundleIdentifier。但我看到了这些问题:

  • 当我为应用程序使用所需的包标识符时,列表中没有显示任何内容。 (此捆绑包 ID 在我的系统上的其他任何地方都不存在。)
  • 将捆绑包标识符更改为与 NumberInput 示例相同会使其显示在列表中,但当我选择它时,它有时会重复列表中的条目,并且通常表现得很奇怪。
  • 当我对包标识符进行轻微修改时,它似乎表现正常,但是一旦我将其更改回原始标识符(所需的标识符),它就会从列表中消失。
  • 如果我退出与输入法相关的进程,再次在菜单中选择它不会重新启动它。

有人知道发生了什么事吗? Apple 的 IMKit 文档几乎不存在,而且似乎没有多少人记录过他们自己制作输入法的尝试。我有什么遗漏的吗?

提前致谢!

PS 是的,我已经尝试注销并重新登录,甚至重新启动计算机,似乎没有什么可以显着改变我上面提到的行为。

I'm trying to create a new input method using Input Method Kit. The documentation is very lacking, but I believe I'm setting the project up correctly and I place the input method into ~/Library/Input Methods after building it. However, I see strange behavior when looking at the list of input sources in Language & Text preferences.

The NumberInput sample seems to work fine for me, and there are no differences in my new input method that I can find, aside from the values for tsInputMethodIconFileKey, InputMethodConnectionName, InputMethodServerControllerClass, and CFBundleIdentifier in Info.plist. But I'm seeing these issues:

  • When I use my desired bundle identifier for the app, nothing shows up in the list. (This bundle ID doesn't exist anywhere else on my system.)
  • Changing the bundle identifier to be the same as the NumberInput sample makes it show up in the list, but when I select it, it sometimes duplicates entries in the list, and generally behaves weirdly.
  • As I make slight modifications to the bundle identifier, it seems to behave normally, but once I change it back to the original identifier (the desired one) it disappears from the list.
  • If I quit the process associated with my input method, selecting it in the menu again doesn't relaunch it.

Does anyone have any idea what's going on? Apple's documentation for IMKit is nearly nonexistant and it doesn't seem like many people have documented their own attempts at making input methods. Is there something I'm missing?

Thanks in advance!

P.S. Yes I've tried logging out and back in and even restarting my computer, nothing seems to significantly change the behavior I mentioned above.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮年慕年 2025-01-04 10:59:16

这对我有用。试试这个:确保您的包标识符在路径中的某个位置包含“inputmethod”。示例“com.blugs.inputmethod.IPAPalette”。是的,据我所知,它完全没有记录。是的,文档很糟糕。希望这有帮助!干杯。

This worked for me. Try this: make sure your bundle identifier contains "inputmethod" somewhere in the path. Example "com.blugs.inputmethod.IPAPalette". Yes AFAIK it's totally undocumented. Yes the documentation is awful. Hope this helps! Cheers.

短暂陪伴 2025-01-04 10:59:16

这里接受的答案非常有用,将 .inputmethod. 添加到您的 Bundle ID 中。

我要补充的是,我在 TextInputSources.h 中找到了一些相关文档,其中包含 输入法套件概述文档。值得一读。

碳>框架> HI工具箱> TextInputSources.h

在 Info.plist 文件中,CFBundleIdentifier 键的值必须是包含 ".keyboardlayout." 的字符串;通常这可能类似于 "com.companyname.keyboardlayout.MyKeyboardLayouts" (在 Leopard 之前,它需要是一个以 "com.apple.keyboardlayout" 开头的字符串,即使对于 Apple 未提供的键盘布局也是如此。

如果未指定此键,则将通过将 BundleID 与通过删除与 BundleID 匹配或以 ".inputmethod." 结尾的任何前缀形成的 InputModeID 后缀组合来构造 InputSourceID。

The accepted answer here is very useful, adding .inputmethod. to your Bundle ID.

I'll add that I found a bit of documentation for this in TextInputSources.h, which contains a large number of comments and documentation not found in the Input Method Kit overview docs. Worth a read.

Carbon > Frameworks > HIToolbox > TextInputSources.h

In the Info.plist file, the value for the CFBundleIdentifier key must be a string that includes ".keyboardlayout."; typically this might be something like "com.companyname.keyboardlayout.MyKeyboardLayouts" (Before Leopard, it was required to be a string that began "com.apple.keyboardlayout", even for keyboard layouts not supplied by Apple).

and

If this key is not specified, an InputSourceID will be constructed by combining the BundleID with an InputModeID suffix formed by deleting any prefix that matches the BundleID or that ends in ".inputmethod."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文