From d6ab086a744fe8e1d5bc071ccd8f0cfa4d272e55 Mon Sep 17 00:00:00 2001 From: DmitriyEshenko Date: Fri, 13 Nov 2020 21:41:15 +0000 Subject: system: T3038: Add keyboard layout CLI command --- interface-definitions/system-options.xml.in | 32 +++++++++++++++++++++++++++++ src/conf_mode/system-options.py | 9 ++++++++ 2 files changed, 41 insertions(+) diff --git a/interface-definitions/system-options.xml.in b/interface-definitions/system-options.xml.in index 297f5891e..fab0c0169 100644 --- a/interface-definitions/system-options.xml.in +++ b/interface-definitions/system-options.xml.in @@ -80,6 +80,38 @@ #include + + + System keyboard layout, type ISO2 + + us fr de fi no dk + + + us + United States of America + + + fr + France + + + de + Germany + + + fi + Finland + + + no + Norway + + + dk + Denmark + + + diff --git a/src/conf_mode/system-options.py b/src/conf_mode/system-options.py index 22765cef7..bf0bd56ec 100755 --- a/src/conf_mode/system-options.py +++ b/src/conf_mode/system-options.py @@ -107,6 +107,15 @@ def apply(options): else: cmd('systemctl disable tuned.service') + # Keyboard layout + if 'keyboard_layout' in options.keys(): + try: + cmd('loadkeys {}'.format(options['keyboard_layout'])) + except OSError: + raise ConfigError('Dos not possible to set {} as keyboard layout'.format(options['keyboard_layout'])) + else: + cmd('loadkeys us') + if __name__ == '__main__': try: c = get_config() -- cgit v1.2.3