I'm using xkbcomp
to swap the Alt and Win keys on an Apple keyboard of mine.
This works:
xkbcomp -w0 -I"$DIR" "$DIR/keymap/mykbd" $DISPLAY
...but it changes the layout for all keyboards, and this will not do because I am frequently changing between a standing and sitting position (and swapping keyboards).
I have taken the trouble of specifying a device. The xkbcomp
help text says: -i <deviceid> Specifies device ID (not name) to compile for
xkbcomp -w0 -I"$DIR" -i 16 "$DIR/keymap/mykbd" $DISPLAY
...but this seems to produce no effect!
I drew the id 16
from xinput list | grep Magic\ Keyboard
. I've also tried /dev/input/event18
as an id, taken from xinput list-props 16 | grep 'Device Node'
, but this produces no better effect.
Update:
Suprisingly, when I provide the id of Virtual core keyboard
instead of Magic Keyboard
, I do get an effect: the new mapping gets applied to my Magic Keyboard, and if I proceed to type on my integrated laptop keyboard, the keymap then reverts to the original configuration.
I can't explain this. Does anyone have any insight?
id
should be a number like16
or18
, not a path like/dev/input/event18
. doublecheck withxinput list
that your hardware isn't presenting two separate entries. note these device ids aren't guaranteed to remain the same after reboot or unplug/replug. – quixotic Jan 11 '18 at 17:3316
initially. And I have double-checked. (I acknowledge that these ids may change after reboot/unplug.) So the question remains why I get no effect when specifying-i <id>
– Jellicle Jan 13 '18 at 01:06/etc/udev/hwdb.d/70-keyboard-local.hwdb
file – Jellicle Aug 31 '20 at 16:52