Skip to content

Swap keys #2

Closed
Closed

Description

@appomsk

I want to swap Caps and Right Command but after assignment Caps (or Right Command), I can no longer use these keys. So it's only one-way assignment.

Activity

  1. alienator88 commented on Sep 18, 2025

    @alienator88
    Owner

    That's likely a macOS limitation. I use the built-in IOKit.hid/hidutil API that macOS offers.
    Other apps like Karabiner Elements install at the kernel level and can make any alteration they want. The hidutil API macOS offers is a little more limited in what it can do.

    As a test, you could try to map this using the hidutil app directly.
    If you can't get it working with hidutil outside of my app either, then that would confirm it's a macOS problem.

  2. appomsk commented on Sep 18, 2025

    @appomsk
    Author

    No. This playlist works, but it can't be created in the app.

    <?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>PearHID.KeyMapping</string>
            <key>ProgramArguments</key>
            <array>
                <string>/usr/bin/hidutil</string>
                <string>property</string>
                <string>--set</string>
                <string>{"UserKeyMapping":[
                    {
                        "HIDKeyboardModifierMappingSrc": 0x700000039,
                        "HIDKeyboardModifierMappingDst": 0x7000000E4
                },
                {
                        "HIDKeyboardModifierMappingSrc": 0x7000000E6,
                        "HIDKeyboardModifierMappingDst": 0x700000039
                }
                ]}</string>
            </array>
            <key>RunAtLoad</key>
            <true/>
        </dict>
    </plist>
    
  3. alienator88 commented on Sep 18, 2025

    @alienator88
    Owner

    Oh, is it because once you use caps lock in the From list, it's disabled and it can't be selected in the To list again?

  4. alienator88 commented on Sep 18, 2025

    @alienator88
    Owner

    Your example seems to map Caps lock > Right Control and then Right Option to Caps lock.

  5. alienator88 commented on Sep 18, 2025

    @alienator88
    Owner

    PearHID.zip

    Can you try this new build? Side note, it hasn't been signed/notarized yet.

  6. appomsk commented on Sep 18, 2025

    @appomsk
    Author

    Well, I tried different combinations. It's just a new MacBook. The problem was that you can't use the same key in two rules. I'll try this build, but not until tomorrow.

  7. alienator88 commented on Sep 18, 2025

    @alienator88
    Owner

    Sounds good, I fixed that issue where you can't use the same key in two rules.
    Notice that you can only use it once in the From and once in the To section.
    It's not possible to make a rule where the From and To keys have duplicates.

  8. appomsk commented on Sep 20, 2025

    @appomsk
    Author

    Everything seems to be working. At least I replaced my manually written plist and used your utility.

    And thank you for PearCleaner. It's wonderful.

  9. alienator88 commented on Sep 22, 2025

    @alienator88
    Owner

    Glad to hear it's sorted!
    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions