16 ( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions ) = getXkbSettings();
21 my ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions );
23 open (XPROP, "xprop -root |") or die "Could not start xprop";
26 if (/_XKB_RULES_NAMES\(STRING\) = \"(.*)\", \"(.*)\", \"(.*)\", \"(.*)\", \"(.*)\"/)
28 ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ) =
29 ( $1, $2, $3, $4, $5 ) ;
35 return ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions );
40 my ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ) = @_;
41 my $outfile = ".test.out.xkb";
42 ( system ( "setxkbmap -rules \"$xkbRules\" " .
43 "-model \"$xkbModel\" " .
44 "-layout \"$xkbLayouts\" " .
45 "-variant \"$xkbVariants\" " .
46 "-option \"$xkbOptions\" " .
47 "-print | xkbcomp - -xkb $outfile" ) == 0 ) or die "Could not set xkb configuration";
51 sub restoreXkbSettings
53 setXkbSettings( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions );
56 sub defaultXkbSettings
58 return ( "base", "pc105", "us", "", "" );
63 my ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ) = @_;
64 print "rules: [$xkbRules]\n" ;
65 print "model: [$xkbModel]\n" ;
66 print "layouts: [$xkbLayouts]\n" ;
67 print "variants: [$xkbVariants]\n" ;
68 print "options: [$xkbOptions]\n" ;
71 sub dumpXkbSettingsBackup
73 dumpXkbSettings( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions );
78 my ( $type, $idx ) = @_;
80 open ( XSLTPROC, "xsltproc --stringparam type $type listCIs.xsl ../rules/base.xml.in |" ) or
81 die ( "Could not start xsltproc" );
88 print "--- setting $type: [$paramValue]\n";
89 my @params = defaultXkbSettings();
90 $params[$idx] = $paramValue;
91 dumpXkbSettings ( @params );
92 setXkbSettings ( @params );
94 #dumpXkbSettings( getXkbSettings() );
102 my ( $type, $subtype, $idx, $delim1, $delim2, $ifCheckLevel1, $ifAddLevel1, $ifResetToDefault ) = @_;
104 open ( XSLTPROC, "xsltproc --stringparam type $type listCIs.xsl ../rules/base.xml.in |" ) or
105 die ( "Could not start xsltproc" );
112 print "--- scanning $type: [$paramValue]\n";
114 if ( $ifCheckLevel1 )
116 my @params = defaultXkbSettings();
117 if ( $ifResetToDefault )
119 setXkbSettings ( @params );
121 $params[$idx] = "$paramValue";
122 dumpXkbSettings ( @params );
123 setXkbSettings ( @params );
124 #print "--- dump:\n";
125 #dumpXkbSettings( getXkbSettings() );
128 open ( XSLTPROC2, "xsltproc --stringparam type $subtype --stringparam parentId $paramValue listCI2.xsl ../rules/base.xml.in |" ) or
129 die ( "Could not start xsltproc" );
136 print " --- $subtype: [$paramValue2]\n";
137 my @params = defaultXkbSettings();
138 if ( $ifResetToDefault )
140 setXkbSettings ( @params );
144 $params[$idx] = "$paramValue$delim1$paramValue2$delim2";
148 $params[$idx] = "$paramValue2";
150 dumpXkbSettings ( @params );
151 setXkbSettings ( @params );
152 #print "--- dump:\n";
153 #dumpXkbSettings( getXkbSettings() );