summaryrefslogtreecommitdiffstats
path: root/lib/keyboard.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/keyboard.pm')
-rw-r--r--lib/keyboard.pm22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/keyboard.pm b/lib/keyboard.pm
index 33ca806..968e79d 100644
--- a/lib/keyboard.pm
+++ b/lib/keyboard.pm
@@ -608,17 +608,17 @@ sub write {
qq( Identifier "system-keyboard"\n) .
q( MatchIsKeyboard "on"\n);
my $isus = $keyboard->{XkbLayout} && $keyboard->{XkbLayout} eq "us";
- if ($keyboard->{XkbLayout} && !$isus) {
- $xorgconf .= " Option \"XkbLayout\" \"" . $keyboard->{XkbLayout} . "\"\n";
- }
- if ($keyboard->{XkbModel} && (!$isus || $keyboard->{XkbModel} ne "pc105")) {
- $xorgconf .= " Option \"XkbModel\" \"" . $keyboard->{XkbModel} . "\"\n";
- }
- if ($keyboard->{XkbVariant}) {
- $xorgconf .= " Option \"XkbVariant\" \"" . $keyboard->{XkbVariant} . "\"\n";
- }
- if ($keyboard->{XkbOptions}) {
- $xorgconf .= " Option \"XkbOptions\" \"" . $keyboard->{XkbOptions} . "\"\n";
+ # kbd_option => enabled?
+ my %is_opt_enabled = (
+ XkbLayout => sub { !$isus },
+ XkbModel => sub { !$isus || $keyboard->{XkbModel} ne "pc105" },
+ XkbVariant => sub { 1 },
+ XkbOptions => sub { 1 },
+ );
+ foreach my $opt (keys %is_opt_enabled) {
+ if ($keyboard->{$opt} && $is_opt_enabled{$opt}) {
+ $xorgconf .= sprintf(q( Option "%s" "%s"\n), $opt, $keyboard->{$opt});
+ }
}
$xorgconf .= "EndSection\n";
output_p("$::prefix/etc/X11/xorg.conf.d/00-keyboard.conf", $xorgconf);