Most informations and code comes from here
-
Copy the
/etc/udev/rules.d/00-usb-keyboard.rules
file -
Modify idVendor, idProduct and OWNER: you can get idProduct and idVendor with
lsusb
-
chmod a+x /etc/udev/rules.d/00-usb-keyboard.rules
-
Copy the
/usr/local/bin/usb-keyboard-udev
file -
Copy the
/usr/local/bin/usb-keyboard
file -
chmod a+x /usr/local/bin/usb-keyboard*
Modify the script /usr/local/bin/usb-keyboard
:
You have to set your keyboard name in the script.
You need to get a distinctive part of your keyboard name.
Just run xinput list
and pick some unique part of the keyboard name.
You have to set the layout, model and variant inside the script. You can get the list of available values with these commands :
localectl list-x11-keymap-models
localectl list-x11-keymap-layouts
localectl list-x11-keymap-variants [layout]
For PC French Keyboard 105 keys => model: pc105, layout: fr, variant: azerty For Mac French Keyboard => model: macintosh, layout: mac-fr, variant: ""
For Mac keyboard, there is some custom layout on the internet, maybe worth trying : http://www.linux-france.org/macintosh/clavier_gentoo.html
cd /usr/share/kbd/keymaps/mac/all
wget ftp://ftp.linux-france.org/pub/macintosh/mac-fr-ext_new.map.gz
gunzip mac-fr-ext_new.map.gz
And use layout 'mac-fr-ext_new'
Hello,
Thanks for your script, it proved quite useful :)
However I think your udev rule
is somehow broken; at least on my distro, each line is evaluated separately, so that the first does not do anything, while the other two will match any usb device.
A fix could be