package keyboard; # $Id$ use diagnostics; use strict; #-###################################################################################### #- misc imports #-###################################################################################### use common qw(:common :system :file); use run_program; use commands; use log; use c; #-###################################################################################### #- Globals #-###################################################################################### my $KMAP_MAGIC = 0x8B39C07F; #- a best guess of the keyboard layout, based on the choosen locale my %lang2keyboard = ( 'af' => 'us_intl', 'az' => 'az', 'be' => 'by', 'be_BY.CP1251' => 'by', 'bg' => 'bg', 'bg_BG'=> 'bg', 'br' => 'fr', 'ca' => 'es', 'cs' => 'cz_qwerty', 'cy' => 'uk', 'da' => 'dk', 'de' => 'de', 'de_AT'=> 'de', 'de_CH'=> 'ch_de', 'de_DE'=> 'de', 'el' => 'gr', 'en' => 'us', 'en_US'=> 'us', 'en_GB'=> 'uk', 'eo' => 'us_intl', 'es' => 'es', 'es@tradicional' => 'es', 'es_AR'=> 'la', 'es_ES'=> 'es', 'es_MX'=> 'la', 'et' => 'ee', 'eu' => 'es', 'fa' => 'ir', 'fi' => 'fi', 'fr' => 'fr', 'fr_BE'=> 'be', 'fr_CA'=> 'qc', 'fr_CH'=> 'ch_fr', 'fr_FR'=> 'fr', 'ga' => 'uk', 'gl' => 'es', 'he' => 'il', 'hr' => 'hr', 'hu' => 'hu', 'hy' => 'am', 'is' => 'is', 'it' => 'it', 'ja' => 'jp', 'ka' => 'ge_la', 'lt' => 'lt', 'mk' => 'mk', 'nb' => 'no', 'nl_BE'=> 'be', 'nl_NL'=> 'us_intl:95 uk:2 nl:1', #'nl_NL'=> 'nl', 'no' => 'no', 'no@nynorsk' => 'no', 'ny' => 'no', 'oc' => 'fr', 'pl' => 'pl', 'pt' => 'pt', 'pt_BR'=> 'br', 'pt_PT'=> 'pt', 'ru' => 'ru', 'ru_RU.KOI8-R' => 'ru', 'sk' => 'sk_qwerty', 'sl' => 'si', 'sp' => 'sr', 'sr' => 'yu', 'sv' => 'se', 'sv@ny' => 'se', 'sv@traditionell' => 'se', 'th' => 'th', 'tr' => 'tr_q', 'uk' => 'ua', 'uk_UA' => 'ua', 'vi' => 'vn', 'vi_VN.tcvn' => 'vn', 'vi_VN.viscii' => 'vn', 'wa' => 'be', ); #- key = extension for Xmodmap file, [0] = description of the keyboard, #- [1] = name for loadkeys, [2] = name for XKB my %keyboards = ( arch() =~ /^sparc/ ? ( "cs" => [ __("Czech (QWERTZ)"), "sunt5-cz-us", "czsk(cz_us_qwertz)" ], "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" ], "uk" => [ __("UK keyboard"), "sunt5-uk", "gb" ], "us" => [ __("US keyboard"), "sunkeymap", "us" ], ) : ( arch() eq "ppc" ? ( "us" => [ __("US keyboard"), "mac-us-ext", "us" ], "de_nodeadkeys" => [ __("German"), "mac-de-latin1-nodeadkeys", "de(nodeadkeys)" ], "fr" => [ __("French"), "mac-fr2-ext", "fr" ], ) : ( "am_old" => [ __("Armenian (old)"), "am_old", "am(old)" ], "am" => [ __("Armenian (typewriter)"), "am-armscii8", "am" ], "am_phonetic" => [ __("Armenian (phonetic)"), "am_phonetic", "am(phonetic)" ], #- only xmodmap is currently available #-"ar" => [ __("Arabic"), "ar-8859_6", "ar" ], "az" => [ __("Azerbaidjani (latin)"), "az", "az" ], "a3" => [ __("Azerbaidjani (cyrillic)"), "az-koi8c","az(cyrillic)" ], "be" => [ __("Belgian"), "be-latin1", "be" ], "bg" => [ __("Bulgarian"), "bg", "bg" ], "br" => [ __("Brazilian (ABNT-2)"), "br-abnt2", "br" ], "by" => [ __("Belarusian"), "by-cp1251", "byru" ], "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)" ], "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)" ], "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", "gr" ], "hu" => [ __("Hungarian"), "hu-latin2", "hu" ], "hr" => [ __("Croatian"), "croat", "yu" ], "il" => [ __("Israeli"), "il-8859_8", "il" ], "il_phonetic" => [ __("Israeli (Phonetic)"),"hebrew", "il_phonetic" ], "ir" => [ __("Iranian"), "ir-isiri3342","ir" ], "is" => [ __("Icelandic"), "is-la