pqrs-org / Karabiner-Elements

Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later.
https://pqrs.org/osx/karabiner/
The Unlicense
18.86k stars 838 forks source link

is possible to change mapping for USB keyboard only? #138

Closed sytler closed 8 years ago

sytler commented 8 years ago

Hi, I'm trying to remap left_cmd with left_option, everything works just fine but, need to remap the keys for external USB keyboard only. Is it even possible with Karabiner Elements? thanks

fengmiaosen commented 8 years ago

+1

bwanamaker commented 8 years ago

Karabiner had the option for excluding Apple keyboards and external keyboards. Having this in Karabiner Elements would be fantastic. I've been looking for some indication that it's simply syntax in the JSON file, but this issue is the first thing I've found related to external keyboards.

xirianlight commented 8 years ago

I primarily use Karabiner so that modifier key holds on an external Apple keyboard effect my laptop's built-in one as well (type with one hand on the laptop keyboard one had on the external Apple USB one). Everything works except, on a fresh install of Karabiner-Elements, that the Option and Command key JUST ON THE EXTERNAL KEYBOARD are flipped. This indicates to me that the software can and does detect the differences between the two of them, I'm just curious how to switch option and command back to their default positions on the external. I'm afraid I don't have much experience editing the preference files outside of the GUI.

EDIT: Finally got the configuration file to load properly and removed the left/right cmd/option lines. Weird that they didn't effect the built-in keyboard, only the external.

adrianluff commented 8 years ago

@xirianlight The problem is your external keyboard is a PC keyboard, which has the option and command keys flipped in hardware. You can create two profiles, one for the PC and another for the Mac and switch between them. See issue #67 for a way to deal with switching back and forth.

Here's an example of how to create the PC config file:

{  "profiles": [
        {
                "name": "Default profile",
                "selected": true,
                "simple_modifications": {
                        "left_command": "left_option",
                        "left_option": "left_command"
                }
        }
]
}
xirianlight commented 8 years ago

@adrianluff Thanks - my external actually isn't a Windows keyboard (I don't own one, oddly), it's an aluminum iMac keyboard with the numeric keypad. The default profile that I found already on my Mac had Option and Command switched, which I found puzzling. I erased those lines and now the behavior is back to normal. Weird, right?

andrewagain commented 8 years ago

+1 for 'external only' mappings. The 'multiple profiles' workaround is not effective for me because I use both my internal and external keyboards at the same time.

K4stor commented 8 years ago

Pleas add support for external only !!!

chuttenh commented 8 years ago

+1, Elements has been serving me well since the Sierra upgrade but I haven't found a way to swap keys only on a built-in (or only on an external) keyboard with it yet.

zxaos commented 8 years ago

Again, see #67 for workarounds (for now) to support switching back and forth between profiles. Not the same as having per-keyboard profiles, but is a viable workaround for many use cases for now.

andrewagain commented 8 years ago

@zxaos workaround has already been mentioned. And as I mentioned, the workaround doesn't help me.

I type with my left hand on an external keyboard and my right hand on my built-in keyboard. Doing so provides relief for a repetitive strain injury in my wrists. For me, not having this fixed is literally painful.

mrwonko commented 8 years ago

I need this as well, would you like me to look into adding this myself? It's Hacktoberfest and I need to open more pull requests. 😁 If so, do you have any pointers on how I should approach this?

tekezo commented 8 years ago

Karabiner-Elements v0.90.58 has Devices tab in Preferences which allows you to choose enabled devices.

andrewagain commented 8 years ago

@tekezo thanks so much for your effort... but this doesn't work quite how it used to work. When I disable my internal keyboard, modifier keys stop working across keyboards.

Let me explain. I have an external windows-style keyboard. I would like to switch the option and command keys on that keyboard only, because they are flipped.

However, I would still like to be able to press CMD on the USB keyboard and 'w' on the internal keyboard to close a window.

Does this make sense? Is this too tricky to implement?

bwanamaker commented 8 years ago

@ahfarmer I've given up on Karabiner because there are options in MacOS to do the first thing you're asking about. It's working wonderfully and I hope it also solves your problem.

The second part seems tricky though, since you're working across 2 different input sources.

System Preferences>Keyboard>Modifier Keys screenshot 2016-11-11 12 06 50

hez commented 7 years ago

@bwanamaker The built in OSX key mappings don't appear to have any effect while karabiner-elements is running. Does this actually work for you?

@ahfarmer I am trying to do the same thing as you, have you found an answer?

andrewagain commented 7 years ago

@hez Good point - the built in OSX key mappings don't work for me either (while karabiner-elements is running).

I haven't found an answer. I just shut karabiner elements down when i am using one keyboard, and run it again when using two. And deal with the fact that cmd/opt are switched on my internal keyboard when i have an external one plugged in.

pehrlich commented 7 years ago

Same Experience as @ahfarmer / @hez here. I would say this issue should be re-opened :-)

gerritgriebel commented 7 years ago

I have mappings only for internal keyboard and mappings only for external keyboard. It would be great if any mapping could be assigned to a device.

starsy commented 7 years ago

@gerritgriebel check out this fork: https://github.com/starsy/Karabiner-Elements prebuilt package is under Release section

pehrlich-stripe commented 7 years ago

@starsy Thank you! works like a charm

gerritgriebel commented 7 years ago

@starsy i switched, perfect, thanks a lot! I just have to make sure to always click "Skip this update", as updating would put me back on Karabiner-Elements master. bildschirmfoto 2017-07-20 um 10 37 29

starsy commented 7 years ago

@gerritgriebel glad to know! thanks for providing the hint, i should make the update to be disabled by default, will change the code.

gerritgriebel commented 7 years ago

Well, this time I did click "Install Update" and I'm now back on the main track. Finally "per-device key mapping support" is available and works fine for me:

bildschirmfoto 2017-08-17 um 15 58 26

emile-3d commented 6 years ago

Hi, per device key mapping works, but I have different keyboard types, one is ANSI and other is ISO. Looks like this option of keyboard type in "virtual keyboards" are global options? Any help is appreciated.

awdng commented 6 years ago

I have the same issue as @emile-3d My Macbooks internal keyboard is ISO (German layout) and my external is ANSI (US english), so the key remappings get messed up between the two and i always have to switch.