How to configure the keyboard on Debian in order
for capslock to function like on Windows, using a
french Apple Keyboard (French (Macintosh)
).
Solution found here, adapted for my old french Macbook Air.
Configuration file to create:
cat <<EOF | sudo tee /usr/share/X11/xkb/symbols/mswindows-capslock
// $XKeyboardConfig$
// Replicate a "feature" of MS Windows on AZERTY keyboards
// where Caps Lock also acts as a Shift Lock on number keys.
// Include keys <AE01> to <AE10> in the FOUR_LEVEL_ALPHABETIC key type.
// adapted for apple french keyboard
partial alphanumeric_keys
xkb_symbols "basic" {
key <TLDE> { type= "FOUR_LEVEL_ALPHABETIC", [ at, numbersign, periodcentered, Ydiaeresis ] };
key <AE01> { type= "FOUR_LEVEL_ALPHABETIC", [ ampersand, 1, VoidSymbol, dead_acute ] };
key <AE02> { type= "FOUR_LEVEL_ALPHABETIC", [ eacute, 2, ediaeresis, Eacute ] };
key <AE03> { type= "FOUR_LEVEL_ALPHABETIC", [ quotedbl, 3, VoidSymbol, VoidSymbol ] };
key <AE04> { type= "FOUR_LEVEL_ALPHABETIC", [ apostrophe, 4, VoidSymbol, VoidSymbol ] };
key <AE05> { type= "FOUR_LEVEL_ALPHABETIC", [ parenleft, 5, braceleft, bracketleft ] };
key <AE06> { type= "FOUR_LEVEL_ALPHABETIC", [ section, 6, paragraph, aring ] };
key <AE07> { type= "FOUR_LEVEL_ALPHABETIC", [ egrave, 7, guillemotleft, guillemotright ] };
key <AE08> { type= "FOUR_LEVEL_ALPHABETIC", [ exclam, 8, exclamdown, Ucircumflex ] };
key <AE09> { type= "FOUR_LEVEL_ALPHABETIC", [ ccedilla, 9, Ccedilla, Aacute ] };
key <AE10> { type= "FOUR_LEVEL_ALPHABETIC", [ agrave, 0, oslash, VoidSymbol ] };
key <AE11> { type= "FOUR_LEVEL_ALPHABETIC", [ parenright, degree, braceright, bracketright ] };
key <AE12> { type= "FOUR_LEVEL_ALPHABETIC", [ minus, underscore, emdash, endash ] };
key <AD11> { type= "FOUR_LEVEL_ALPHABETIC", [ dead_circumflex, dead_diaeresis, ocircumflex, Ocircumflex ] };
key <AD12> { type= "FOUR_LEVEL_ALPHABETIC", [ dollar, asterisk, EuroSign, yen ] };
key <AC11> { type= "FOUR_LEVEL_ALPHABETIC", [ ugrave, percent, Ugrave, ucircumflex ] };
key <BKSL> { type= "FOUR_LEVEL_ALPHABETIC", [ dead_grave, sterling, at, numbersign ] };
key <LSGT> { type= "FOUR_LEVEL_ALPHABETIC", [ less, greater, VoidSymbol, VoidSymbol ] };
key <AB07> { type= "FOUR_LEVEL_ALPHABETIC", [ comma, question, VoidSymbol, questiondown ] };
key <AB08> { type= "FOUR_LEVEL_ALPHABETIC", [ semicolon, period, VoidSymbol, periodcentered ] };
key <AB09> { type= "FOUR_LEVEL_ALPHABETIC", [ colon, slash, division, backslash ] };
key <AB10> { type= "FOUR_LEVEL_ALPHABETIC", [ equal, plus, VoidSymbol, plusminus ] };
};
EOF
Keyboard in use:
xkbcomp -xkb :0 - 2>/dev/null |grep 'name\[group'
name[group1]="French (Macintosh)";
name[group2]="French (alt.)";
File to modify: /usr/share/X11/xkb/symbols/fr
Search: French (Macintosh)
Add: include "mswindows-capslock"
ath the end of the block.
E.g.:
[...]
// Copied from macintosh_vndr/fr
partial alphanumeric_keys
xkb_symbols "mac" {
name[Group1]= "French (Macintosh)";
key <TLDE> { [ at, numbersign, periodcentered, Ydiaeresis ] }; // MISSING: Ydiaeresis; eherlent : ok in Latin9
[...]
key <KPDL> { [ comma,KP_Decimal ] };
include "level3(ralt_switch)"
include "mswindows-capslock"
};
[...]
Found another way, not tested:
setxkbmap -option caps:shiftlock
as Application autostart with the desktop environment