gui: simplify setting guivm xid and keyboard layout

This commit is contained in:
Frédéric Pierret (fepitre) 2019-10-20 17:35:43 +02:00
parent d2d1ffb806
commit 5ee2f5d889
No known key found for this signature in database
GPG Key ID: 484010B5CDC576E2

View File

@ -61,17 +61,12 @@ class GUI(qubes.ext.Extension):
pass
# Add GuiVM Xen ID for gui-daemon
try:
if vm.guivm is not None:
if str(vm.name) != str(vm.guivm.name):
vm.untrusted_qdb.write('/qubes-gui-domain-xid',
str(vm.guivm.xid))
except AttributeError:
vm.untrusted_qdb.write('/qubes-gui-domain-xid', '')
if getattr(vm, 'guivm', None):
if vm != vm.guivm:
vm.untrusted_qdb.write('/qubes-gui-domain-xid',
str(vm.guivm.xid))
# Add keyboard layout from that of GuiVM
try:
kbd_layout = vm.guivm.features['keyboard-layout']
vm.untrusted_qdb.write('/keyboard-layout', kbd_layout)
except AttributeError:
vm.untrusted_qdb.write('/keyboard-layout', '')
# Add keyboard layout from that of GuiVM
kbd_layout = vm.guivm.features.get('keyboard-layout', None)
if kbd_layout:
vm.untrusted_qdb.write('/keyboard-layout', kbd_layout)