Search code examples
macoscommand-line-interfacedefaultdotfiles

Command to change the value of "Use the Caps Lock key to switch to and from U.S."


I'm currently developing my own macOS dotfiles.

I wasn't able to find a command that I can use to change the value of "Use the Caps Lock key to switch to and from U.S." I was trying to find it by using the defaults command.

I need a command to turn it on.

What I want to change


Solution

  • I found one useful trick. In order to find the defaults key for this setting, I opened terminal and wrote next command:

    defaults read > 1
    

    Then I turned this setting off and executed:

    defaults read > 2
    

    And then after we saved 2 files, we can find the difference:

    diff 1 2
    

    Here I was trying to find the key in the defaults which was affected, and I found it.

    Here is a command for changing the value of "Use the Caps Lock key to switch to and from U.S.":

    # Use the Caps Lock key to switch to and from U.S.
    defaults write NSGlobalDomain TISRomanSwitchState -int 1
    # Possible values: `0` - off, `1` - on