diff --git a/qubes/ext/gui.py b/qubes/ext/gui.py index 2dc005d8..69e97df6 100644 --- a/qubes/ext/gui.py +++ b/qubes/ext/gui.py @@ -21,8 +21,6 @@ # License along with this library; if not, see . # -import subprocess - import qubes.config import qubes.ext @@ -81,16 +79,15 @@ class GUI(qubes.ext.Extension): if kbd_layout: vm.untrusted_qdb.write('/keyboard-layout', kbd_layout) - # Legacy value for setting keyboard layout - try: - xkb_keymap = subprocess.run(['/usr/bin/setxkbmap', '-print'], - stdout=subprocess.PIPE, - check=False) - if xkb_keymap.stdout: - vm.untrusted_qdb.write('/qubes-keyboard', xkb_keymap.stdout) - except FileNotFoundError: - # Prevent any reason for 'setxkbmap' being not present - pass + # Legacy value for setting keyboard layout + xkb_keymap = \ + 'xkb_keymap {\x0a\x09xkb_keycodes { include ' \ + '"evdev"\x09};\x0a\x09xkb_types { include ' \ + '"complete"\x09};\x0a\x09xkb_compat { include ' \ + '"complete"\x09};\x0a\x09xkb_symbols { include ' \ + '"pc+%s+inet(evdev)"\x09};\x0a\x09xkb_geometry ' \ + '{ include "pc(pc105)"\x09};\x0a};' % kbd_layout + vm.untrusted_qdb.write('/qubes-keyboard', xkb_keymap) # Set GuiVM prefix guivm_windows_prefix = vm.features.get('guivm-windows-prefix', 'GuiVM') diff --git a/qubes/tests/vm/qubesvm.py b/qubes/tests/vm/qubesvm.py index 3d9c7a9b..8d50007c 100644 --- a/qubes/tests/vm/qubesvm.py +++ b/qubes/tests/vm/qubesvm.py @@ -1833,6 +1833,13 @@ class TC_90_QubesVM(QubesVMTestsMixin, qubes.tests.QubesTestCase): vm.netvm = None vm.guivm = guivm guivm.features['keyboard-layout'] = 'fr' + xkb_keymap = \ + 'xkb_keymap {\x0a\x09xkb_keycodes { include ' \ + '"evdev"\x09};\x0a\x09xkb_types { include ' \ + '"complete"\x09};\x0a\x09xkb_compat { include ' \ + '"complete"\x09};\x0a\x09xkb_symbols { include ' \ + '"pc+fr+inet(evdev)"\x09};\x0a\x09xkb_geometry ' \ + '{ include "pc(pc105)"\x09};\x0a};' vm.events_enabled = True test_qubesdb = TestQubesDB() mock_qubesdb.write.side_effect = test_qubesdb.write @@ -1843,7 +1850,7 @@ class TC_90_QubesVM(QubesVMTestsMixin, qubes.tests.QubesTestCase): '/name': 'test-inst-appvm', '/type': 'AppVM', '/default-user': 'user', - '/qubes-keyboard': unittest.mock.ANY, + '/qubes-keyboard': xkb_keymap, '/keyboard-layout': 'fr', '/qubes-vm-type': 'AppVM', '/qubes-gui-domain-xid': '{}'.format(guivm.xid),