Karabiner-elements: where to put the karabiner.json file?

Created on 22 Sep 2016  ·  33Comments  ·  Source: pqrs-org/Karabiner-Elements

Hi,

I am kinda new to karabiner elements. I have installed Karabiner Elements and checked the examples.
After I start the app, in the Simple Modifications Tab it shows me that I should modify the _karabiner.json_ file. But where should I put it after that?

Thx!

stale

Most helpful comment

Since v0.90.71: The karabiner.json location has been changed to ~/.config/karabiner/karabiner.json.

All 33 comments

Do these steps

mkdir -p ~/.karabiner.d/configuration/
touch karabiner.json
open karabiner.json

@talha131 it works, thank you very much! 😬

@talha131 What is "touch" and "open"? Is it not enough to simply put the karabiner.json configuration file in the ~/.karabiner.d/configuration/ folder and run Karabiner-Elements? Not even sure I understand what kind of command "touch" is, or how one "opens" a config file?

@Kionoko You are right. I added these commands to make it easy for @dyyce to kick start his Karabiner-Elements configuration.

Anyway, touch filename creates a file if it does not exists. If the file exists, touch changes the file's access and modification times. touch karabiner.json creates the file. I added this line because some users have asked (#48) do they have to create file manually.

open command is available only in OS X. It opens the file in the default application. So open karabiner.json opens the file in your default editor, be it TextEdit or MacVim.

Well, I copied over the JIS layout XML, converted them to JSON, but I have no idea if it does anything at all. I'm guessing no, because none of my muscle memory has produced any key strokes producing the right character.

I guess I'm not super clear on how to know if the JSON file is even being loaded.

Can you please paste the contents here?

...I think this is the relevant code:

           {
              "name": "Use US Keyboard as Japanese Keyboard",
              "item": [
                 {
                    "name": "Use US Keyboard as Japanese Keyboard",
                    "identifier": "remap.jis_layout_us2japanese",
                    "autogen": [
                       "__SetKeyboardType__ KeyboardType::JIS_MACBOOK_2008"
                    ]
                 },
                 {
                    "name": "Options",
                    "item": [
                       {
                          "name": "Backquote(`) to JIS Yen(¥)",
                          "identifier": "option.jis_layout_us2japanese_backquote2yen",
                          "autogen": [
                             "__KeyToKey__ KeyCode::BACKQUOTE, KeyCode::JIS_YEN"
                          ]
                       },
                       {
                          "name": "Backquote(`) to Backslash",
                          "identifier": "option.jis_layout_us2japanese_backquote2backslash",
                          "autogen": [
                             "__KeyToKey__ KeyCode::BACKQUOTE, KeyCode::VK_JIS_BACKSLASH"
                          ]
                       },
                       {
                          "name": "Shift+Delete to Pipe(|)",
                          "identifier": "option.jis_layout_us2japanese_shiftDelete2pipe",
                          "autogen": [
                             "__KeyToKey__ KeyCode::DELETE, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT | ModifierFlag::NONE, KeyCode::VK_JIS_BACKSLASH, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT"
                          ]
                       },
                       {
                          "name": "Shift_R to Shift_R",
                          "appendix": [
                             "(+ When you type Shift_R only, send Underscore)"
                          ],
                          "identifier": "option.jis_layout_us2japanese_shiftR2shiftR_underscore",
                          "autogen": [
                             "__KeyOverlaidModifier__ KeyCode::SHIFT_R, KeyCode::SHIFT_R, KeyCode::JIS_UNDERSCORE"
                          ]
                       },
                       {
                          "name": "(Shift_L+Shift_R to Underscore)",
                          "identifier": "option.jis_layout_us2japanese_shiftR2shiftR_shiftLshiftR2underscore",
                          "autogen": [
                             "__KeyToKey__ KeyCode::SHIFT_R, ModifierFlag::SHIFT_L, KeyCode::JIS_UNDERSCORE"
                          ]
                       }
                    ]
                 }
              ]
           }

I am unfamiliar with JIS and from #87, it seems you are trying to map US layout to Japanese. I will try to help as much as I can.

With this in mind, your json is incorrect.

Can you please try replacing your karabiner.json with this

{
    "profiles": [
        {
            "name": "Default profile",
            "selected": true,
            "simple_modifications": {
                "grave_accent_and_tilde": "backslash"
            }
        }
    ]
}

Quit karabiner and then relaunch it. If everything works, then when you press ``, you will get`.

Let me know how it goes.

Yes. I have a US MacBook, but I have never actually USED it as a US keyboard because @tekezo's solution meant I never had to learn the US Keyboard (ありがとうございました、高山さん!). So it drives me quite insane now.

I don't know anything about coding really, let alone how XML and JSON differ or how commands are called or anything like that. I'm a Social Studies teacher. :P

And yes, it worked! What now... there are a lot of keys I need moved.

@Kionoko You have to copy from US to Japanese one key at a time. I don't know which Japanese keys are supported at this time.

Nonetheless, look for keys here (in the highlighted section).

Say you want to convert, left ⌘Command key to left ⌥Option (alt) key.

{
    "profiles": [
        {
            "name": "Default profile",
            "selected": true,
            "simple_modifications": {
                "grave_accent_and_tilde": "backslash",
                "left_command": "left_option"
            }
        }
    ]
}

Notice that I,

  1. added a comma to the last rule "grave_accent_and_tilde": "backslash".
  2. Started a new line.
  3. Added the new rule

I got left_command and left_option from here.

You will have to add rules this way.

There are also some Japanese keys in the code. I have no idea what purpose do they server. Perhaps they will make sense to you.

Thank you, @talha131! Yes, they do make sense to me. I think, however, that left_option should be replaced by left_command, instead (likewise, right_option by right_command). As left_command needs to be replaced by EISUU and right_command needs to be replaced by KANA.

But wow, that will be very slow if I have to move every single key by hand.

And also, am I to understand simple modifications means no combinations yet? So I can't move ' from its position on the US layout to its JIS layout as shift+7? Or moving the parenthesis to the left by one over, or moving the @ from shift+2 to ]? Etc, etc?

I am not quite familiar with using Japanese keyboard layouts, or anything significantly different from US Intl for that matter, but is there a reason why you would go this way instead of just selecting a different keyboard layout in your MacOS settings?

@Punksmurf, I've tried figuring out how the heck to do that, and I can't figure out how! It's a MacBook so I don't seem to have the option to Change Keyboard Layout, trying to run Keyboard Assist just gives me an error

First I tried this:

{
"profiles": [
{
"name": "Default profile",
"selected": true,
"simple_modifications": {
"grave_accent_and_tilde": "backslash",
"left_option”: "left_command”,
"right_option": "right_command",
"left_command": "japanese_eisuu",
"right_command": "japanese_kana"
}
}
]
}

But that did not work. Then I tried this:

{
"profiles": [
{
"name": "Default profile",
"selected": true,
"simple_modifications": {
"grave_accent_and_tilde": "backslash",
"left_command": "japanese_eisuu",
"right_command": "japanese_kana"
}
}
]
}

That gave me control of switching between かな and 英数, as I just demonstrated in the typing of this very sentence, BUT it took away my ability to command+c, command+v. I'll try tossing the option/command switches in after the 英数 and かな/command lines...

But wow, that will be very slow if I have to move every single key by hand.

I think you are over estimating. It won't take too long. In any case, there is no other way around it. Also once you are done, please open a pull request to add your json into examples folder.

And also, am I to understand simple modifications means no combinations yet?

You are right. You can't do it now. Watch for #16 for updates on this feature.

Punksmurf, I've tried figuring out how the heck to do that, and I can't figure out how!

I think @Punksmurf meant something like this.

But that is what I already have, of course. US/Kana/Hiragana/Romaji (what used to be called Kotoeri). @Punksmurf, that doesn't change layout. It just lets you do romaji input and produce Japanese characters. Letters are entirely in the same place on both ANSI and JIS, it's the punctuation and key combinations which are different. As a touch-typist of JIS, this is what I need. I don't actually look at the keyboard.

This paragraph alone took me at least three times longer than it should for me to have written, because I kept going for the wrong punctuation keys. :|

Okay, I have seriously _no_ idea if this is helpful to you or anything close what you want, so if not, sorry. The thing is, after switching they keyboard layout I have not a single clue as to what I am doing, seeing as I don't understand Japanese.

Anyway, what I meant was: open system settings, choose keyboard, choose input sources. Add "Japanese" as an input source. There are some customisation options there, but they don't mean much to me. Using the flag in the menu bar you can now choose Romaji, Katakana or Hiragana. After that, certain key combinations result in text in the chosen script. For example, typing "ji" using Katakana yields "ジ".

You seem to be more interested in using single keys for single characters though, as I understand it. I do not know if that is possible using this method.

@Punksmurf, see above. I am not concerned about letters. The letters do not move. I use romaji input to produce Japanese characters, as you just did. HOWEVER, what drives me nuts is that the apostrophe is halfway across the keyboard, and the at symbol is too, none of the symbols above the numbers are in the right place, the parenthesis are a key over... Maddening.

Yeah I read your comment after I placed mine, sorry about that. So as I understand it, you want to use this input method, only move certain keys like ' and @ over to another spot?

(For me, when trying Romaji, they are in the same spot as indicated on my keyboard (the @ is shift+2, ' is to the right of ; which is to the right of L.)

That's exactly right, @Punksmurf. That was what Karabiner used to do for me. Since I'm a Japanese touch typist, I can't as easily use a US keyboard. I have to look down to remember where the correct keys are. I could eventually learn, of course. But if this problem persists in future versions of macOS, I just will buy a Japanese keyboard version MacBook when it is time for me to upgrade. So there is no point in rewriting my muscle memory. It'd just hurt me in the end.

Back to the JSON lines, this works.

{
"profiles": [
{
"name": "Default profile",
"selected": true,
"simple_modifications": {
"grave_accent_and_tilde": "backslash",
"left_command": "japanese_eisuu",
"right_command": "japanese_kana",
"left_option": "left_command",
"right_option": "right_command"
}
}
]
}

I now have 英数/かな, and option has been switched with command, so I can use option+whatever just like I used to use command+whatever, like copy and paste. That already makes my life easier. However, considering the amount of punctuation which is shift+something combinations, I admit, I am not sure how much more I am going to be able to manage.

Please add the commands @talha131 indicated to the actual panes in the app until it's fully featured.

This will cut back on redundant issues being open.

Please =)

@bellwood are you talking to me? Because I have no idea what that means!

Friendly reminder to everyone. I am not a technical person. I'm a JHS social studies teacher. Maybe some people would consider me a quick learner, but I signed up for GitHub just so I could interact on this particular project, because for years, essentially it was a "set and go" sort of thing. Many times I actively forgot that KeyRemap/Karabiner was even there. Only when I upgraded software and needed to reset it did I remember it was there.

So everyone needs to be patient with me and fully explain, step by step, what they want me to do. I have no background in computing project collaboration, I don't know what a lot of these words mean. I assume a "pull" means "this code works, so please include it in a future version," and I know what preference panes are, but I have no idea how to modify application panes, @bellwood!

@Kionoko Don't worry @bellwood message is not intended for you.

That already makes my life easier.

Good to know. Hope #16 gets implemented soon so that rest of your issues get resolved.

I don't know if there is a way to add an image, but it's worth pointing out that this is the keyboard I need to remap to:

http://s3.amazonaws.com/dotclue.org/kybard.jpg

Also, I guess someone (maybe myself?) can delete my own issue, since all the work is being done here.

I'm now using Key Maestro for the combination punctuation issues, but I hope #16 gets resolved before 45 days runs out. As it is, Karabiner-Elements + Key Maestro seems to give me all the functionality I need.

@talha131 thank you =)

Sorry for any confusion - should have tagged my comment =)

Could someone please share the json code for remapping the Right Option key to Right Click? Thanks!

@robertimes I suggest you to open a new issue. This will help @tekezo to tag and filter issues easily. Secondly from #93, I think this should work.

{
    "profiles": [
        {
            "name": "Default profile",
            "selected": true,
            "simple_modifications": {
                "right_option" : "application"
            }
        }
    ]
}

@Kionoko
This JSON File is working 英数/かな.

{
"profiles": [
{
"name": "Japanese Keyboard for MacOS profile",
"selected": true,
"simple_modifications": {
// ### Kana Setup ### //
"international2": "right_gui",
"international4": "japanese_kana",
"international5": "japanese_eisuu"
}
}
]
}

@Mr24 Yoshio, how does that produce a different result than my current JSON set up? I've been using it for a few hours, and I think I've got everything remapped between the two programs. Now that it's working, I'm not sure I want to mess around with it.

Since v0.90.71: The karabiner.json location has been changed to ~/.config/karabiner/karabiner.json.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings