This is a followup to #303:
@tekezo wrote:
Karabiner-Elements v0.90.58 has Devices tab in Preferences which allows you to choose enabled devices.
Thanks a lot for that! But: the original requirement (as written in the initial text by @starsy) hasn't really been fulfilled:
As I have an external PC keyboard connected to my MBP, some key mappings should just apply on the external one, otherwise the keys will be very confusing when switching over between using the internal one and external one
This is my exact requirement. I use a PC-style keyboard, where Cmd and Alt have different placement than on the builtin MBP keyboard, so I used to have a KeyRemac4MacBook setting that used different profiles for these different keyboards.
That was an incredibly useful feature. Sorry to rain on your parade, and I definitely appreciate all the hard work you (and others) are putting into this. But, this specific issue (#303) would preferably be reopened and we can then close it when the full support for keyboard-specific bindings (for individual bindings) have been implemented.
@starsy also wrote:
@perlun, cannot agree with you more.
If Karabiner can support which key mapping to be enabled on which keyboard, it would make a big difference there.
E.g. on my internal keyboard, I always map "Right Option" to be "Forward Delete", but this mapping should not be enabled on my external keyboard as there is already a Delete key there. Meanwhile as external PC keyboard doesn't have a Fn key, so I need to map either "Right Control" or "Application" key to be Fn, this setting should not be enabled on my internal keyboard.
So in the "Simple Modifications" Tab, if there adds a drop-down list to select which device to enable which mapping, it would be fantastic!
Again, @tekezo, thanks for Karabiner team's great effort. This is just my 2%, hope it can make Karabiner better.
I think, if we could start with adding karabiner.json-only support for it (i.e. no preferences UI), it would be a great start. Right now, I handpatch my karabiner.json every time I switch keyboards which is a bit annoying. 馃槉
Thanks for tracking this feature request, @perlun !
Definitely missing this ability. I used to run a little script I called toggle-workstation.sh which toggled the selected _profile_ everytime I would switch between laptop keyboard and external keyboard and other settings (natural scrolling via osascript). Here's a snippet:
# Toggle Karabiner profile (macOS/TECK)
selected=$(/Applications/Karabiner.app/Contents/Library/bin/karabiner selected)
select=$([ "$selected" = "0" ] && echo 1 || echo 0)
/Applications/Karabiner.app/Contents/Library/bin/karabiner select "$select"
unset selected select
Definitely missing this ability. I used to run a little script I called toggle-workstation.sh which toggled the selected profile everytime I would switch between laptop keyboard and external keyboard and other settings (natural scrolling via osascript)
I just do it manually for now ("commenting" some of the bindings by giving the an invalid key name, like zleft_command instead of left_command). Your solution is somewhat more elegant, but I'd really really really like this to be builtin to the software.
Almost willing to implement it myself, but I think I'd need a really big pointer as to where in the source code this should be implemented to get it doable...
Did you try creating two profiles in the json configuration, one for each device?
There's also the selected parameter in the json configuration, I wonder if that could be toggled dynamically..
Finally I have to DIY this for myself after a long time waiting. Made some enhancements to KBE to remove the pain of switching profiles for 2+ keyboards by supporting per-device configuration. Please take a look at https://github.com/starsy/Karabiner-Elements if you are interested in. The release/download link is here: https://github.com/starsy/Karabiner-Elements/releases/tag/v1.0_merged . Pull request is here: https://github.com/tekezo/Karabiner-Elements/pull/752. It works pretty stably on my MBPR, I think it worths a try. Hope it can solve your problems too. Please don't hesitate to let me know if any issues or questions.

@perlun @sitaktif @rafi
Most helpful comment
Finally I have to DIY this for myself after a long time waiting. Made some enhancements to KBE to remove the pain of switching profiles for 2+ keyboards by supporting per-device configuration. Please take a look at https://github.com/starsy/Karabiner-Elements if you are interested in. The release/download link is here: https://github.com/starsy/Karabiner-Elements/releases/tag/v1.0_merged . Pull request is here: https://github.com/tekezo/Karabiner-Elements/pull/752. It works pretty stably on my MBPR, I think it worths a try. Hope it can solve your problems too. Please don't hesitate to let me know if any issues or questions.
@perlun @sitaktif @rafi