You are not logged in.

#1 2021-01-08 19:02:02

edbucker
Member
Registered: 2021-01-08
Posts: 2

[SOLVED] 2 diff. keyboards: how to set persistant setxkbmap --device?

I've replaced Ubuntu for Arch on this Lenovo 81TR IdeaPad L340-15IRH Gaming notebook, which I use along with another machine. They both share the same bluetooth keyboard from Logitech K380. It was a switch to change profiles so I can connect to one or another. Altho, my notebook keyboard have one layout (br-abnt2) while the K380 (us-intl) have another.

I've managed to set different layouts for each device using

setxkbmap -device <device-id>

I'm getting the ids with

xinput -list | grep -i key
$ xinput -list | grep -i key
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Video Bus                               	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Power Button                            	id=8	[slave  keyboard (3)]
    ↳ Integrated Camera: Integrated C         	id=9	[slave  keyboard (3)]
    ↳ Ideapad extra buttons                   	id=11	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=12	[slave  keyboard (3)]
    ↳ Keyboard K380 System Control            	id=14	[slave  keyboard (3)]
    ↳ Keyboard K380 Keyboard                  	id=15	[slave  keyboard (3)]
    ↳ Keyboard K380 Consumer Control          	id=16	[slave  keyboard (3)]

$ setxkbmap -device 11 -model abnt2 -layout br -variant abnt2
$ setxkbmap -device 15 -model abnt2 -layout us -variant intl

The problem is the bluetooth keyboard might have a different id per session. I've experienced it at reboot, when the notebook keyboard was kept with the correct configuration and the K380 missed it.

So I'm wondering if there's an way to make it persistent. Thanks in advance for any ideas.

Note: I believe the id is changing due to some delay on blueman-applet to start up. I've set it on bspwmrc but this last time I booted it didn't work. Not sure if thats relevant.

These are my configs:

eduardo@archibald 
OS: Arch Linux x86_64 
Host: 81TR IdeaPad L340-15IRH Gaming 
Kernel: 5.4.87-1-lts 
Uptime: 15 mins 
Packages: 793 (pacman) 
Shell: zsh 5.8 
Resolution: 1920x1080 
WM: bspwm 
Theme: Adwaita-dark [GTK2/3] 
Icons: ArchLabs-Dark [GTK2/3] 
Terminal: kitty 
Terminal Font: MesloLGS NF 
CPU: Intel i7-9750H (12) @ 4.500GHz 
GPU: Intel UHD Graphics 630 
GPU: NVIDIA GeForce GTX 1050 3 GB Max-Q 
Memory: 1996MiB / 15892MiB 

Last edited by edbucker (2021-01-09 19:27:32)

Offline

#2 2021-01-09 19:27:04

edbucker
Member
Registered: 2021-01-08
Posts: 2

Re: [SOLVED] 2 diff. keyboards: how to set persistant setxkbmap --device?

I've solved this problem by editing /etc/X11/xorg.conf.d/00-keyboard.conf, so I'm leaving this here for newbies who bump into such issue.

❯ cat /etc/X11/xorg.conf.d/00-keyboard.conf
Section "InputClass"
        Identifier "Ideapad extra buttons"
        MatchIsKeyboard "on"
        Option "XkbLayout" "br"
        Option "XkbModel" "abnt2"
        Option "XkbVariant" "abnt2"
EndSection

Section "InputClass"
        Identifier "Keyboard K380 Keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us"
        Option "XkbModel" "abnt2"
        Option "XkbVariant" "intl"
EndSection% 

Offline

Board footer

Powered by FluxBB