Change the layout on an external keyboard

You can change the layout on an external keyboard without changing your built in keyboards layout using setxkbmap

You use the xinput command to list the external keyboard id,
however running xinput on Freebsd didnt show my external keyboard but running xinput on linux worked

Ive had to switch back to my linux machine because im having issue upgrading Freebsd to 12.1

Im not sure why xinput on Freebsd doesnt show the external keyboard,
maybe im missing some package or something

To find the keyboards id run xinput

Bash:
xinput

The output from xinput looks like this

Bash:
⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ bcm5974                                     id=11    [slave  pointer  (2)]
⎜   ↳ BenQ ZOWIE BenQ ZOWIE Gaming Mouse          id=13    [slave  pointer  (2)]
⎜   ↳ Ducky Ducky One2 Mini RGB                   id=15    [slave  pointer  (2)]
⎣ Virtual core keyboard                       id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
    ↳ Power Button                                id=6    [slave  keyboard (3)]
    ↳ Video Bus                                   id=7    [slave  keyboard (3)]
    ↳ Power Button                                id=8    [slave  keyboard (3)]
    ↳ Sleep Button                                id=9    [slave  keyboard (3)]
    ↳ Apple Inc. Apple Internal Keyboard / Trackpad    id=10    [slave  keyboard (3)]
    ↳ FaceTime Camera (Built-in): Fac             id=12    [slave  keyboard (3)]
    ↳ Ducky Ducky One2 Mini RGB                   id=14    [slave  keyboard (3)]
    ↳ Ducky Ducky One2 Mini RGB                   id=16    [slave  keyboard (3)]
    ↳ Ducky Ducky One2 Mini RGB                   id=17    [slave  keyboard (3)]

In this case the id we want is id 14
Ducky Ducky One2 Mini RGB id=14[slave keyboard (3)]

we use setxkbmap with the -device option and the device id

Bash:
setxkbmap -device 14 -layout gb -variant mac -option ctrl:swap_lalt_lctl,altwin:alt_super_win

In this example im setting the layout to gb the variant to mac and using the ctrl:swap_lalt_lctl,altwin:alt_super_win options

To remove the setxkbmap options for the external keyboard we run setxkbmap -option without any options

Bash:
setxkbmap -device 14 -layout gb -variant mac -option

Trying to use xinput with the following code fails on freebsd

Bash:
setxkbmap -device 14 -layout gb -variant mac -option ctrl:swap_lalt_lctl,altwin:alt_super_win

xinput on freebsd only shows the following on my macbook air running freebsd
whereas my macbook air running ubuntu does show the external keyboard

Bash:
⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ sysmouse                                    id=7    [slave  pointer  (2)]
⎣ Virtual core keyboard                       id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
    ↳ kbdmux                                      id=6    [slave  keyboard (3)]

if i google "freebsd xinput not showing keyboard" it returns this post as the top hit

Not sure why xinput on freebsd doesnt show the external keyboard

Running xinput -list --long doesnt show anything either

Bash:
xinput -list --long

Not sure if another package is required on freebsd or what the issue is
 
Back
Top