How to make the Linux keyboard behave like MS french keyboard
French users moving from windows to linux will get confused with the keyboard behaviour, when swithcing CAPS lock doesn’t make the first line write numbers as they used to have in windows. I searched a lot in the internet, and from what I understood, linux users consider that the MS behaviour is wrong and there may never be a fix out of the box to get it working that way. For me, it’s more about habit. And I feel that when it’s possible to make a machine work according to my habits, I will fix that. The amazing thing with linux is the possiblities to customize the OS, some learning is needed to get things work as wanted.
For the keyboard behaviour follow these steps :
- Create a file named mswindows-capslock
sudo nano mswindows-capslock
- Insert this code in this newly created file :
// $XKeyboardConfig$
// -------------- fr ---------------
// Reproduit une fonctionalite/un bug (j'vais pas troller la dessus) de Windows pour les claviers AZERTY
// Ou le caps-lock agis aussi comme un shift-lock sur les touches des nombres et des symboles
// Version "complete" basée sur celle pour les nombres seulement de Yves Bruggeman
// Postée sur le bugtracker : https://bugs.launchpad.net/ubuntu/+bug/292158
// Si vous avez des questions ou autre, contactez moi sur twitter: @prototux ou par mail: jasonx86.sh at gmail...
// Instructions d'installation (NB: "mswindows-capslock" est un nom de votre choix)
// Modifiez le fichier /usr/share/X11/symbols/fr (ou be) : ajoutez/copiez/collez [i]include "mswindows-capslock"[/i]
// dans le paragraphe xkb_symbols correspondant a votre variante de clavier ("default" par exemple)
// (gardez les guillemets, comme pour les autres imports). C'est tout pour ce fichier.
// Éditez le code ci dessous et remplacez y le nom de configuration ("basic") après le mot xkb_symbols
// par le nom de votre variante de clavier, entre guillemets ("default" par exemple)
// Copiez/collez ce fichier, modifié, comme "mswindows-capslock" dans le dossier /usr/share/X11/xkb/symbols
// Rechargez la configuration clavier en le changeant (passez de francais a variante et revenez à francais par exemple)
// -------------- en ---------------
// Replicate a feature/bug (i won't troll on that) of MS Windows on AZERTY keyboards
// where Caps Lock also acts as a Shift Lock on number and symbols keys.
// "Complete" version based on the numbers-only version from Yves Bruggeman
// Posted in the ubuntu bugtracker: https://bugs.launchpad.net/ubuntu/+bug/292158
// For questions or whatelse, ask me on twitter @prototux or by mail: jasonx86.sh at gmail...
// HOWTO install
// Edit your /usr/share/X11/xkb/symbols/fr (or be)
// Import this file by copy-pasting - include "mswindows-capslock" - in the xkb_symbols configuration of your keyboard variant
// Copy/paste this file as "mswindows-capslock" in the /usr/share/X11/xkb/symbols folder
// Edit this file : replace "basic" after xkb_symbols with the name of your keyboard variant
// Reload the keyboard conf by changing it (like "french" to "french variant" and come back to "french")
partial alphanumeric_keys
xkb_symbols "basic" {
// Line 1: Power two/tilde, numbers, degree and plus re-mapping
key <TLDE> { type= "FOUR_LEVEL_ALPHABETIC", [ twosuperior, asciitilde, notsign, notsign ] };
key <AE01> { type= "FOUR_LEVEL_ALPHABETIC", [ ampersand, 1, bar, exclamdown ] };
key <AE02> { type= "FOUR_LEVEL_ALPHABETIC", [ eacute, 2, at, oneeighth ] };
key <AE03> { type= "FOUR_LEVEL_ALPHABETIC", [ quotedbl, 3, numbersign, sterling ] };
key <AE04> { type= "FOUR_LEVEL_ALPHABETIC", [ apostrophe, 4, onequarter, dollar ] };
key <AE05> { type= "FOUR_LEVEL_ALPHABETIC", [ parenleft, 5, onehalf, threeeighths ] };
key <AE06> { type= "FOUR_LEVEL_ALPHABETIC", [ section, 6, asciicircum, fiveeighths ] };
key <AE07> { type= "FOUR_LEVEL_ALPHABETIC", [ egrave, 7, braceleft, seveneighths ] };
key <AE08> { type= "FOUR_LEVEL_ALPHABETIC", [ exclam, 8, bracketleft, trademark ] };
key <AE09> { type= "FOUR_LEVEL_ALPHABETIC", [ ccedilla, 9, braceleft, plusminus ] };
key <AE10> { type= "FOUR_LEVEL_ALPHABETIC", [ agrave, 0, braceright, degree ] };
key <AE11> { type= "FOUR_LEVEL_ALPHABETIC", [ parenright, degree, bracketright, questiondown ] };
key <AE12> { type= "FOUR_LEVEL_ALPHABETIC", [ equal, plus, braceright, dead_ogonek ] };
// Line 2: Diaersis and sterling
key <AD11> { type= "FOUR_LEVEL_ALPHABETIC", [ dead_circumflex, dead_diaeresis, dead_diaeresis, dead_abovering ] };
key <AD12> { type= "FOUR_LEVEL_ALPHABETIC", [ dollar, sterling, currency, dead_macron ] };
// Line 3: Percentage and mu
key <AC11> { type= "FOUR_LEVEL_ALPHABETIC", [ ugrave, percent, dead_circumflex, dead_caron ] };
key <BKSL> { type= "FOUR_LEVEL_ALPHABETIC", [ asterisk, mu, dead_grave, dead_breve ] };
// Line 4: Greater, question mark, dot, slash and section
key <LSGT> { type= "FOUR_LEVEL_ALPHABETIC", [ less, greater, lessthanequal, greaterthanequal ] };
key <AB07> { type= "FOUR_LEVEL_ALPHABETIC", [ comma, question, dead_acute, dead_doubleacute ] };
key <AB08> { type= "FOUR_LEVEL_ALPHABETIC", [ semicolon, period, horizconnector, multiply ] };
key <AB09> { type= "FOUR_LEVEL_ALPHABETIC", [ colon, slash, periodcentered, division ] };
key <AB10> { type= "FOUR_LEVEL_ALPHABETIC", [ exclam, section, dead_belowdot, dead_abovedot ] };
};
- Move this file to
/usr/share/X11/xkb/symbols/
sudo mv mswindows-capslock /usr/share/X11/xkb/symbols/mswindows-capslock
- Open
/usr/share/X11/xkb/symbols/fr
sudo nano /usr/share/X11/xkb/symbols/fr
-
Search for
xkb_symbols "basic" {
-
Add this line right after it :
include "mswindows-capslock(basic)"
- Open keyboard settings and add french standard keyboard
Voila
Source : [TUTORIEL] Reproduire le comportement caps-lock de Windows sur Ubuntu
Comments