Catch and change keyboard on mac sierra to emulate neo2 keyboard layout

北慕城南 提交于 2019-12-12 04:31:04

问题


I am using the optimised layout neo2: https://www.neo-layout.org/

Unfortunately the mac version was based on karabiner (https://pqrs.org/osx/karabiner/) which has stopped working since the Sierra update. There is a promising new Version called karabiner elements (https://github.com/tekezo/Karabiner-Elements) which will hopefully solve this problem.

Since i do not now when the fix will work on mac sierra, I am looking for a non generic "quick and dirty" solution, which just maps the standard german keyboard to the neo layout.

  1. Is it possible to catch keyboard events for mac systemwide?
  2. Which language/frameworks would i have to use to be able to achieve this workaround?

回答1:


I would suggest using KeyBindingsEditor to create/edit your key bindings file, which should be located/created here: {your user folder}/Library/KeyBindings/DefaultKeyBinding.dict

Note that your key bindings file must use UTF-8 encoding, and you must restart your computer after making modifications for them to take effect.

Also, here is some more information about custom key bindings in macOS that you may find helpful.




回答2:


Using the Solution above i was able to get my 4. Layer back with some smaller problems.

Here is what i did:

Step 1: Create a DefaultKeyBinding.dict File (i was wrong, the BindingsEditor works)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"       "http://www.apple.com/DTDs/
<plist version="1.0">
<dict>
  <key>^a</key>
  <string>moveDown:</string>
  <key>^c</key>
  <string>deleteForward:</string>
  <key>^e</key>
  <string>moveForward:</string>
  <key>^i</key>
  <string>moveBackward:</string>
  <key>^l</key>
  <string>moveUp:</string>
  <key>^o</key>
  <string>moveToEndOfLine:</string>
  <key>^u</key>
  <string>moveToBeginningOfLine:</string>
  <key>^v</key>
  <string>deleteBackward:</string>
</dict>
</plist>

Step 2: Remap Command_Right to ctrl_left

Problems

This approach seems not to work in every program. Mappings to cmd+* (which i actually want did not work) This are just a few issues which i noticed just by playing around (probably because of ctrl+* premapped shortcuts):

  • In spotlight search the left shortcut works fine, but the right shortcut always goes to the end of the line
  • The Microsoft Excel App goes completely crazy when using this shortcut
  • This Editor that i am typing this in uses other shortcuts as well

Conclusion

First, I would also like to mention this blog post: http://slongwell.github.io/articles/2016-09/karabiner-workaround

This approach does work to a certain extend and is definitely an option until Karabiner solves the Problem. However, if you find a better solution, feel free to post in here.



来源:https://stackoverflow.com/questions/40932684/catch-and-change-keyboard-on-mac-sierra-to-emulate-neo2-keyboard-layout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!