ergosteur / cf-keylayout

Clavier Canadien-Français pour Mac OS X
175 stars 31 forks source link

Inverting right-side controls #27

Open payne911 opened 3 years ago

payne911 commented 3 years ago

Could anyone give me the instructions so that I could swap the Cmd and the Opt buttons, but only the ones on the right side of the Space bar ?

I've used the Keyboard System Preferences' Key Modifiers to invert the Cmd and the Ctrl so that I can have something closer to a Windows keyboard, but now this is the last piece of the puzzle for me to have something extremely close which will match with this keyboard layout.

Thanks!

stuntman999 commented 1 year ago

Don't know if this was resolve... But you can invert right cmd and opt by using hidutil.

You can do the change permanently by creating this file with the code below. Don't forget to reboot after creating the file.

~/Library/LaunchAgents/com.local.KeyRemapping.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.local.KeyRemapping</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/hidutil</string>
        <string>property</string>
        <string>--set</string>
        <string>{"UserKeyMapping":[
            {
              "HIDKeyboardModifierMappingSrc": 0x7000000E6,
              "HIDKeyboardModifierMappingDst": 0x7000000E7
            },
            {
              "HIDKeyboardModifierMappingSrc": 0x7000000E7,
              "HIDKeyboardModifierMappingDst": 0x7000000E6
            }
        ]}</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
payne911 commented 1 year ago

The above didn't work for me. :(

stuntman999 commented 1 year ago

This Work for me in Ventura 13.2...

Can you try this in Terminal ? This will do the same as with the script but will be lost after a reboot...

hidutil property --set '{"UserKeyMapping":
    [{"HIDKeyboardModifierMappingSrc":0x7000000e7,
      "HIDKeyboardModifierMappingDst":0x7000000e6},
     {"HIDKeyboardModifierMappingSrc":0x7000000e6,
      "HIDKeyboardModifierMappingDst":0x7000000e7}]
}'