diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/keyboard.pm | 272 |
1 files changed, 162 insertions, 110 deletions
diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm index e7d076bd1..9ab053539 100644 --- a/perl-install/keyboard.pm +++ b/perl-install/keyboard.pm @@ -20,25 +20,20 @@ use c; my $KMAP_MAGIC = 0x8B39C07F; #- a best guess of the keyboard layout, based on the choosen locale -#- beware only the first 5 characters are used +#- beware only the first 5 characters of the locale are used my %lang2keyboard = ( 'af' => 'us_intl', #-'ar' => 'ar:80 ar_d:70 ar_azerty:60 ar_azerty_d:50', 'az' => 'az:80 tr:10 us_intl:5', -'az_AZ'=> 'az:80 tr:10 us_intl:5', 'be' => 'by:80 ru:50 ru_yawerty:40', -'be_BY'=> 'by:80 ru:50 ru_yawerty:40', 'bg' => 'bg_phonetic:60 bg:50', -'bg_BG'=> 'bg_phonetic:60 bg:50', 'br' => 'fr:90', 'bs' => 'hr:60 yu:50 si:40', 'ca' => 'es:89 fr:15', -'ca_ES'=> 'es:89 fr:15', - 'cs' => 'cz_qwerty:70 cz:50 cz_prog:10', + 'cs' => 'cz_qwerty:70 cz:50', 'cy' => 'uk:90', 'da' => 'dk:90', -'da_DK'=> 'dk:90', 'de' => 'de_nodeadkeys:70 de:50', 'de_AT'=> 'de_nodeadkeys:70 de:50', 'de_BE'=> 'be:70 de_nodeadkeys:60 de:50', @@ -59,10 +54,8 @@ my %lang2keyboard = 'es_MX'=> 'la:80 us_intl:50 es:20', 'et' => 'ee:90', 'eu' => 'es:89 fr:15', -'eu_ES'=> 'es:89 fr:15', 'fa' => 'ir:90', 'fi' => 'fi:90', -'fi_FI'=> 'fi:90', 'fr' => 'fr:90', 'fr_BE'=> 'be:85 fr:5', 'fr_CA'=> 'qc:85 fr:5', @@ -70,7 +63,6 @@ my %lang2keyboard = 'fr_FR'=> 'fr:90', 'fr_LU'=> 'fr:70 de_nodeadkeys:50 de:40 be:35', 'ga' => 'uk:90', -'ga_IE'=> 'uk:90', 'gd' => 'uk:90', 'gl' => 'es:90', 'gv' => 'uk:90', @@ -81,11 +73,11 @@ my %lang2keyboard = 'id' => 'us:90 us_intl:20', 'is' => 'is:90', 'iu' => 'iu:90', + 'it' => 'it:90', 'it_CH' => 'ch_fr:80 ch_de:60 it:50', 'it_IT' => 'it:90', 'ja' => 'jp:80 us:50 us_intl:20', 'ka' => 'ge_la:80 ge_ru:50', -'ka_GE'=> 'ge_la:80 ge_ru:50', 'kl' => 'dk:80 us_intl:30', 'ko' => 'kr:80 us:60', 'kw' => 'uk:90', @@ -101,7 +93,6 @@ my %lang2keyboard = 'nn' => 'no:85 dvorak_no:10', 'no' => 'no:85 dvorak_no:10', 'oc' => 'fr:90', -'oc_FR'=> 'fr:90', 'ph' => 'us:90 us_intl:20', 'pl' => 'pl:80 pl2:60', 'pp' => 'br:80 la:20 pt:10 us_intl:30', @@ -110,7 +101,8 @@ my %lang2keyboard = 'ro' => 'ro2:80 ro:40 us-intl:10', 'ru' => 'ru:85 ru_yawerty:80', 'ru_RU'=> 'ru:85 ru_yawerty:80', - 'sk' => 'sk_qwerty:80 sk:70 sk_prog:50', +'ru_UA'=> 'ua:50 ru:40 ru_yawerty:30', + 'sk' => 'sk_qwerty:80 sk:70', 'sl' => 'si:80 hr:50', 'sp' => 'sr:80', 'sq' => 'al:80', @@ -124,125 +116,176 @@ my %lang2keyboard = 'tr' => 'tr_q:85 tr_q:30', 'tt' => 'ru:50 ru_yawerty:40', 'uk' => 'ua:85 ru:50 ru_yawerty:40', -'uk_UA'=> 'ua:85 ru:50 ru_yawerty:40', 'uz' => 'us:80', 'vi' => 'vn:80 us:60 us_intl:50', -'vi_VN'=> 'vn us:60 us_intl:50', 'wa' => 'be:85 fr:5', -'wa_BE'=> 'be:85 fr:5', 'zh_CN'=> 'us:60', +'zh_HK'=> 'us:60', 'zh_TW'=> 'us:60', ); +# USB kbd table +# The numeric values are the bCountryCode field (5th byte) of HID descriptor +my %usb2drakxkbd = +( + 0x00 => undef, #- the keyboard don't tell its layout + 0x01 => 'ar', + 0x02 => 'be', +#-0x03 => 'ca', #- "Canadian bilingual" ?? + 0x04 => 'qc', #- Canadian French + 0x05 => 'cz', + 0x06 => 'dk', + 0x07 => 'fi', + 0x08 => 'fr', + 0x09 => 'de', + 0x0a => 'gr', + 0x0b => 'il', + 0x0c => 'hu', + 0x0d => 'us_intl', #- "international ISO" ?? + 0x0e => 'it', + 0x0f => 'jp', + 0x10 => 'kr', #- Korean + 0x11 => 'la', + 0x12 => 'nl', + 0x13 => 'no', + 0x14 => 'ir', + 0x15 => 'pl', + 0x16 => 'pt', + 0x17 => 'ru', + 0x18 => 'sk', + 0x19 => 'es', + 0x1a => 'se', + 0x1b => 'ch_de', + 0x1c => 'ch_de', + 0x1d => 'ch_de', #- USB spec says just "Swiss" + 0x1e => 'tw', # Taiwan + 0x1f => 'tr_q', + 0x20 => 'uk', + 0x21 => 'us', + 0x22 => 'yu', + 0x23 => 'tr_f', +#- higher codes not attribued as of 2002-02 +); + #- key = extension for Xmodmap file, [0] = description of the keyboard, -#- [1] = name for loadkeys, [2] = name for XKB +#- [1] = name for loadkeys, [2] = name for XKB, [3] = "1" if it is +#- a multigroup layout (eg: one with latin/non-latin letters) my %keyboards = ( arch() =~ /^sparc/ ? ( - "cz" => [ __("Czech (QWERTZ)"), "sunt5-cz-us", "cz" ], - "de" => [ __("German"), "sunt5-de-latin1", "de" ], - "dvorak" => [ __("Dvorak"), "sundvorak", "dvorak" ], - "es" => [ __("Spanish"), "sunt5-es", "es" ], - "fi" => [ __("Finnish"), "sunt5-fi-latin1", "fi" ], - "fr" => [ __("French"), "sunt5-fr-latin1", "fr" ], - "no" => [ __("Norwegian"), "sunt4-no-latin1", "no" ], - "pl" => [ __("Polish"), "sun-pl-altgraph", "pl" ], - "ru" => [ __("Russian"), "sunt5-ru", "ru" ], + "cz" => [ __("Czech (QWERTZ)"), "sunt5-cz-us", "cz", 0 ], + "de" => [ __("German"), "sunt5-de-latin1", "de", 0 ], + "dvorak" => [ __("Dvorak"), "sundvorak", "dvorak",0 ], + "es" => [ __("Spanish"), "sunt5-es", "es", 0 ], + "fi" => [ __("Finnish"), "sunt5-fi-latin1", "fi", 0 ], + "fr" => [ __("French"), "sunt5-fr-latin1", "fr", 0 ], + "no" => [ __("Norwegian"), "sunt4-no-latin1", "no", 0 ], + "pl" => [ __("Polish"), "sun-pl-altgraph", "pl", 0 ], + "ru" => [ __("Russian"), "sunt5-ru", "ru", 1 ], # TODO: check the console map - "se" => [ __("Swedish"), "sunt5-fi-latin1", "se" ], - "uk" => [ __("UK keyboard"), "sunt5-uk", "gb" ], - "us" => [ __("US keyboard"), "sunkeymap", "us" ], + "se" => [ __("Swedish"), "sunt5-fi-latin1", "se", 0 ], + "uk" => [ __("UK keyboard"), "sunt5-uk", "gb", 0 ], + "us" => [ __("US keyboard"), "sunkeymap", "us", 0 ], ) : ( - "al" => [ __("Albanian"), "al", "al" ], - "am_old" => [ __("Armenian (old)"), "am_old", "am(old)" ], - "am" => [ __("Armenian (typewriter)"), "am-armscii8", "am" ], - "am_phonetic" => [ __("Armenian (phonetic)"), "am_phonetic", "am(phonetic)" ], -#-"ar_azerty" => [ __("Arabic (AZERTY)"), "ar-8859_6", "ar(azerty)" ], -#-"ar_azerty_d" => [ __("Arabic (AZERTY, arabic digits)"),"ar-8859_6","ar(azerty_digits)" ], -#-"ar" => [ __("Arabic (QWERTY)"), "ar-8859_6", "ar" ], -#-"ar_d" => [ __("Arabic (QWERTY, arabic digits)"),"ar-8859_6","ar(digits)" ], - "az" => [ __("Azerbaidjani (latin)"), "az", "az" ], -#"a3" => [ __("Azerbaidjani (cyrillic)"), "az-koi8k","az(cyrillic)" ], - "be" => [ __("Belgian"), "be2-latin1", "be" ], -"bg_phonetic" => [ __("Bulgarian (phonetic)"), "bg", "bg(phonetic)" ], - "bg" => [ __("Bulgarian (BDS)"), "bg", "bg" ], - "br" => [ __("Brazilian (ABNT-2)"), "br-abnt2", "br" ], - "by" => [ __("Belarusian"), "by-cp1251", "by" ], - "ch_de" => [ __("Swiss (German layout)"), "sg-latin1", "de_CH" ], - "ch_fr" => [ __("Swiss (French layout)"), "fr_CH-latin1", "fr_CH" ], -#"cz" => [ __("Czech (QWERTZ)"), "cz-latin2", "czsk(cz_us_qwertz)" ], -#"cz_qwerty" => [ __("Czech (QWERTY)"), "cz-lat2", "czsk(cz_us_qwerty)" ], -#"cz_prog" => [ __("Czech (Programmers)"), "cz-lat2-prog", "czsk(us_cz_prog)" ], - "cz" => [ __("Czech (QWERTZ)"), "cz-latin2", "cz" ], - "cz_qwerty" => [ __("Czech (QWERTY)"), "cz-lat2", "cz_qwerty" ], - "de" => [ __("German"), "de-latin1", "de" ], - "de_nodeadkeys" => [ __("German (no dead keys)"), "de-latin1-nodeadkeys", "de(nodeadkeys)" ], - "dk" => [ __("Danish"), "dk-latin1", "dk" ], - "dvorak" => [ __("Dvorak (US)"), "pc-dvorak-latin1", "dvorak" ], - "dvorak_no" => [ __("Dvorak (Norwegian)"), "no-dvorak", "dvorak(no)" ], - "dvorak_se" => [ __("Dvorak (Swedish)"), "se-dvorak", "dvorak(se)" ], - "ee" => [ __("Estonian"), "ee-latin9", "ee" ], - "es" => [ __("Spanish"), "es-latin1", "es" ], - "fi" => [ __("Finnish"), "fi-latin1", "fi" ], - "fr" => [ __("French"), "fr-latin1", "fr" ], - "ge_ru"=>[__("Georgian (\"Russian\" layout)"),"ge_ru-georgian_academy","ge_ru"], - "ge_la"=>[__("Georgian (\"Latin\" layout)"),"ge_la-georgian_academy","ge_la"], - "gr" => [ __("Greek"), "gr-8859_7", "el" ], - "hu" => [ __("Hungarian"), "hu-latin2", "hu" ], - "hr" => [ __("Croatian"), "croat", "hr" ], - "il" => [ __("Israeli"), "il-8859_8", "il" ], - "il_phonetic" => [ __("Israeli (Phonetic)"),"hebrew", "il_phonetic" ], - "ir" => [ __("Iranian"), "ir-isiri3342","ir" ], - "is" => [ __("Icelandic"), "is-latin1", "is" ], - "it" => [ __("Italian"), "it-latin1", "it" ], -#"iu" => [ __("Inuktitut"), "iu", "iu" ], - "jp" => [ __("Japanese 106 keys"), "jp106", "jp" ], + "al" => [ __("Albanian"), "al", "al", 0 ], + "am_old" => [ __("Armenian (old)"),"am_old", "am(old)", 1 ], + "am" => [ __("Armenian (typewriter)"),"am-armscii8","am", 1 ], + "am_phonetic" => [ __("Armenian (phonetic)"),"am_phonetic","am(phonetic)",1 ], +#-"ar_azerty" => [ __("Arabic (AZERTY)"),"ar-8859_6","ar(azerty)",1 ], +#-"ar_azerty_d" => [ __("Arabic (AZERTY, arabic digits)"),"ar-8859_6","ar(azerty_digits)",1 ], +#-"ar" => [ __("Arabic (QWERTY)"),"ar-8859_6", "ar", 1 ], +#-"ar_d" => [ __("Arabic (QWERTY, arabic digits)"),"ar-8859_6","ar(digits)",1 ], + "az" => [ __("Azerbaidjani (latin)"),"az", "az", 0 ], +#"a3" => [ __("Azerbaidjani (cyrillic)"), "az-koi8k","az(cyrillic)",1 ], + "be" => [ __("Belgian"), "be2-latin1", "be", 0 ], +"bg_phonetic" => [ __("Bulgarian (phonetic)"),"bg", "bg(phonetic)", 1 ], + "bg" => [ __("Bulgarian (BDS)"), "bg", "bg", 1 ], + "br" => [ __("Brazilian (ABNT-2)"),"br-abnt2", "br", 0 ], + "by" => [ __("Belarusian"), "by-cp1251", "by", 1 ], + "ch_de" => [ __("Swiss (German layout)"), "sg-latin1", "de_CH", 0 ], + "ch_fr" => [ __("Swiss (French layout)"), "fr_CH-latin1", "fr_CH", 0 ], + "cz" => [ __("Czech (QWERTZ)"), "cz-latin2", "cz", 0 ], + "cz_qwerty" => [ __("Czech (QWERTY)"), "cz-lat2", "cz_qwerty", 0 ], + "de" => [ __("German"), "de-latin1", "de", 0 ], + "de_nodeadkeys" => [ __("German (no dead keys)"), "de-latin1-nodeadkeys", "de(nodeadkeys)", 0 ], + "dk" => [ __("Danish"), "dk-latin1", "dk", 0 ], + "dvorak" => [ __("Dvorak (US)"), "pc-dvorak-latin1", "dvorak", 0 ], + "dvorak_no" => [ __("Dvorak (Norwegian)"), "no-dvorak", "dvorak(no)", 0 ], + "dvorak_se" => [ __("Dvorak (Swedish)"), "se-dvorak", "dvorak(se)", 0 ], + "ee" => [ __("Estonian"), "ee-latin9", "ee", 0 ], + "es" => [ __("Spanish"), "es-latin1", "es", 0 ], + "fi" => [ __("Finnish"), "fi-latin1", "fi", 0 ], + "fr" => [ __("French"), "fr-latin1", "fr", 0 ], + "ge_ru"=>[__("Georgian (\"Russian\" layout)"),"ge_ru-georgian_academy","ge_ru",1], + "ge_la"=>[__("Georgian (\"Latin\" layout)"),"ge_la-georgian_academy","ge_la",1], + "gr" => [ __("Greek"), "gr-8859_7", "el", 1 ], + "hu" => [ __("Hungarian"), "hu-latin2", "hu", 0 ], + "hr" => [ __("Croatian"), "croat", "hr", 0 ], + "il" => [ __("Israeli"), "il-8859_8", "il", 1 ], + "il_phonetic" => [ __("Israeli (Phonetic)"), "hebrew", "il_phonetic", 1 ], + "ir" => [ __("Iranian"), "ir-isiri3342", "ir", 1 ], + "is" => [ __("Icelandic"), "is-latin1", "is", 0 ], + "it" => [ __("Italian"), "it-latin1", "it", 0 ], +#"iu" => [ __("Inuktitut"), "iu", "iu", 1 ], + "jp" => [ __("Japanese 106 keys"), "jp106", "jp", 1 ], #There is no XKB korean file yet; but using xmodmap one disables # some functioanlity; "us" used for XKB until this is fixed - "kr" => [ __("Korean keyboard"),"us", "us" ], - "la" => [ __("Latin American"), "la-latin1", "la" ], - "lt" => [ __("Lithuanian AZERTY (old)"), "lt-latin7","lt_a" ], + "kr" => [ __("Korean keyboard"), "us", "us", 1 ], + "la" => [ __("Latin American"), "la-latin1", "la", 0 ], + "lt" => [ __("Lithuanian AZERTY (old)"), "lt-latin7", "lt_a", 0 ], #- TODO: write a console kbd map for lt_new - "lt_new" => [ __("Lithuanian AZERTY (new)"), "lt-latin7","lt_std" ], - "lt_b" => [ __("Lithuanian \"number row\" QWERTY"), "ltb-latin7", "lt" ], - "lt_p" => [ __("Lithuanian \"phonetic\" QWERTY"), "ltp-latin7", "lt_p" ], - "lv" => [ __("Latvian"), "lv-latin7", "lv" ], - "mk" => [ __("Macedonian"), "mk", "mk" ], - "nl" => [ __("Dutch"), "nl-latin1", "nl" ], - "no" => [ __("Norwegian"), "no-latin1", "no" ], - "pl" => [ __("Polish (qwerty layout)"), "pl", "pl" ], - "pl2" => [ __("Polish (qwertz layout)"), "pl-latin2", "pl2" ], - "pt" => [ __("Portuguese"), "pt-latin1", "pt" ], - "qc" => [ __("Canadian (Quebec)"), "qc-latin1","ca_enhanced" ], + "lt_new" => [ __("Lithuanian AZERTY (new)"), "lt-latin7", "lt_std", 0 ], + "lt_b" => [ __("Lithuanian \"number row\" QWERTY"), "ltb-latin7", "lt", 0 ], + "lt_p" => [ __("Lithuanian \"phonetic\" QWERTY"), "ltp-latin7", "lt_p", 0 ], + "lv" => [ __("Latvian"), "lv-latin7", "lv", 0 ], + "mk" => [ __("Macedonian"), "mk", "mk", 1 ], + "nl" => [ __("Dutch"), "nl-latin1", "nl", 0 ], + "no" => [ __("Norwegian"), "no-latin1", "no", 0 ], + "pl" => [ __("Polish (qwerty layout)"), "pl", "pl", 0 ], + "pl2" => [ __("Polish (qwertz layout)"), "pl-latin2", "pl2", 0 ], + "pt" => [ __("Portuguese"), "pt-latin1", "pt", 0 ], + "qc" => [ __("Canadian (Quebec)"), "qc-latin1", "ca_enhanced", 0 ], #- TODO: write a console kbd map for ro2 - "ro2" => [ __("Romanian (qwertz)"), "ro2", "ro2" ], - "ro" => [ __("Romanian (qwerty)"), "ro", "ro" ], - "ru" => [ __("Russian"), "ru4", "ru(winkeys)" ], - "ru_yawerty" => [ __("Russian (Yawerty)"),"ru-yawerty","ru_yawerty" ], - "se" => [ __("Swedish"), "se-latin1", "se" ], - "si" => [ __("Slovenian"), "slovene", "si" ], -# "sk" => [ __("Slovakian (QWERTZ)"), "sk-qwertz", "czsk(sk_us_qwertz)" ], -# "sk_qwerty" => [ __("Slovakian (QWERTY)"), "sk-qwerty", "czsk(sk_us_qwerty)" ], -# "sk_prog" => [ __("Slovakian (Programmers)"), "sk-prog", "czsk(us_sk_prog" ], - "sk" => [ __("Slovakian (QWERTZ)"), "sk-qwertz", "sk" ], - "sk_qwerty" => [ __("Slovakian (QWERTY)"), "sk-qwerty", "sk_qwerty" ], + "ro2" => [ __("Romanian (qwertz)"), "ro2", "ro2", 0 ], + "ro" => [ __("Romanian (qwerty)"), "ro", "ro", 0 ], + "ru" => [ __("Russian"), "ru4", "ru(winkeys)", 1 ], + "ru_yawerty" => [ __("Russian (Yawerty)"), "ru-yawerty", "ru_yawerty", 1 ], + "se" => [ __("Swedish"), "se-latin1", "se", 0 ], + "si" => [ __("Slovenian"), "slovene", "si", 0 ], + "sk" => [ __("Slovakian (QWERTZ)"), "sk-qwertz", "sk", 0 ], + "sk_qwerty" => [ __("Slovakian (QWERTY)"), "sk-qwerty", "sk_qwerty", 0 ], # TODO: console map - "sr" => [ __("Serbian (cyrillic)"), "yu", "sr" ], + "sr" => [ __("Serbian (cyrillic)"), "yu", "sr", 0 ], # no console kbd that I'm aware of - "tml" => [ __("Tamil"), "us", "tml" ], - "th" => [ __("Thai keyboard"), "th", "th" ], + "tml" => [ __("Tamil"), "us", "tml", 1 ], + "th" => [ __("Thai keyboard"), "th", "th", 1 ], # TODO: console map - "tj" => [ __("Tajik keyboard"), "tj", "tj" ], - "tr_f" => [ __("Turkish (traditional \"F\" model)"), "trf", "tr_f" ], - "tr_q" => [ __("Turkish (modern \"Q\" model)"), "tr_q-latin5", "tr" ], - "ua" => [ __("Ukrainian"), "ua", "ua" ], - "uk" => [ __("UK keyboard"), "uk", "gb" ], - "us" => [ __("US keyboard"), "us", "us" ], - "us_intl" => [ __("US keyboard (international)"), "us-latin1", "us_intl" ], - "vn" => [ __("Vietnamese \"numeric row\" QWERTY"),"vn-tcvn", "vn(toggle)" ], - "yu" => [ __("Yugoslavian (latin)"), "yu", "hr" ], + "tj" => [ __("Tajik keyboard"), "tj", "tj", 1 ], + "tr_f" => [ __("Turkish (traditional \"F\" model)"), "trf", "tr_f", 0 ], + "tr_q" => [ __("Turkish (modern \"Q\" model)"), "tr_q-latin5", "tr", 0 ], +#-"tw => [ __("Chineses bopomofo"), "tw", "tw", 1 ], + "ua" => [ __("Ukrainian"), "ua", "ua", 1 ], + "uk" => [ __("UK keyboard"), "uk", "gb", 0 ], + "us" => [ __("US keyboard"), "us", "us", 0 ], + "us_intl" => [ __("US keyboard (international)"), "us-latin1", "us_intl", 0 ], + "vn" => [ __("Vietnamese \"numeric row\" QWERTY"),"vn-tcvn", "vn(toggle)", 0 ], + "yu" => [ __("Yugoslavian (latin)"), "yu", "yu", 0 ], ), ); +#- list of possible choices for the key combinations to toggle XKB groups +#- (eg in X86Config file: XkbOptions "grp:toggle") +my %kbdgrptoggle = +( + 'toggle' => _("Right Alt key"), + 'shift_toggle' => _("Both Shift keys simultaneously"), + 'ctrl_shift_toggle' => _("Control and Shift keys simultaneously"), + 'caps_toggle' => _("CapsLock key"), + 'ctrl_alt_toggle' => _("Ctrl and Alt keys simultaneously"), + 'alt_shift_toggle' => _("Alt and Shift keys simultaneously"), + 'menu_toggle' => _("\"Menu\" key"), +); + + #-###################################################################################### #- Functions #-###################################################################################### @@ -298,6 +341,15 @@ sub lang2keyboard { my $kb = lang2keyboards($l)->[0][0]; $keyboards{$kb} ? $kb : "us"; #- handle incorrect keyboad mapping to us. } +sub usb2drakxkbd { + my ($cc) = @_; + my $kb = usb2drakxkbd{$cc}; +#- TODO: detect when undef is returned because it is actualy not defined +#- ($cc == 0) and when it is because of an unknown/not listed number; +#- in that last case it would be nice to display a dialog telling the +#- user to report the number to us. + $kb; +} sub load { my ($keymap) = @_; |