For a MacOS app I use (Notion), I wish to toggle the sidebar via the app-designated keyboard shortcut ⌘ + \. This shortcut works fine on US English keyboard layouts, but not on the Swedish keyboard I'm using.
The key that is reserved for \ (next to Return) on US English keyboards, instead types ' on Swedish keyboards.
I presumed that Karabiner-Elements could potentially solve this problem by remapping the shortcuts.
However, when inspecting Karabiner-EventViewer, it shows that pressing ' appears as \ in the event log:
type:key_down code:49 name:backslash misc: type:key_up code:49 name:backslash misc:
If Karabiner-Elements interprets the key ' as \, then it would seem I'm out of luck to remap these keys, since I'm assuming the script would essentially build on being able to discern between these two keys.
I'm not experienced with Karabiner, but below is roughly how I intended to solve the problem using a Complex Modification in karabiner.json. Please note that I have copied bits from other sources and adapted them – I don't know if the structure and options are correct as they are untested.
As you can see, it probably doesn't make sense to rebind from
"key_code":"backslash"
to
"key_code":"backslash"
.
{
"manipulators":[
{
"description":"Notion: Remap CMD + ' to CMD + Backslash",
"from":{
"key_code":"backslash",
"modifiers":{
"mandatory":[
"right_command"
]
}
},
"to":[
{
"key_code":"backslash",
"modifiers":[
"right_command"
]
}
],
"conditions":[
{
"type":"frontmost_application_if",
"bundle_identifiers":[
"^notion.id"
]
}
],
"type":"basic"
}
]
}
How can I solve this problem? Can Karabiner-elements be made to accurately interpret ' in its EventViewing capacity, or can I use some key designation in the JSON specific to '? Or use some other solution entirely?
"key_code":"7", "modifiers":["right_command", "right_option", "right_shift"]
, but did not work."key_code": 49, ...
?