From c139c35c38603f2c7b79d914d546ff49a3b87677 Mon Sep 17 00:00:00 2001 From: Ali Mirjamali Date: Thu, 30 Oct 2025 12:46:55 +0330 Subject: [PATCH] Update qubesdb first on keyboard layout change It is better to update `keyboard-layout` of GUIVM in qubesdb before propagating the layout change to its child qubes. While this does not fix the original layout change propagation bug (there is another PR for that). It is still more logical related: https://github.com/QubesOS/qubes-issues/issues/8441 related: https://github.com/QubesOS/qubes-issues/issues/6517 --- qubes/ext/gui.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qubes/ext/gui.py b/qubes/ext/gui.py index a78aa82b8..01027c66b 100644 --- a/qubes/ext/gui.py +++ b/qubes/ext/gui.py @@ -159,6 +159,12 @@ def on_keyboard_reset(self, vm, event, name, oldvalue=None): @qubes.ext.handler("property-set:keyboard_layout") def on_keyboard_set(self, vm, event, name, newvalue, oldvalue=None): + if newvalue == oldvalue: + return + + if vm.is_running(): + vm.untrusted_qdb.write("/keyboard-layout", newvalue) + for domain in vm.app.domains: if getattr( domain, "guivm", None @@ -169,9 +175,6 @@ def on_keyboard_set(self, vm, event, name, newvalue, oldvalue=None): oldvalue=oldvalue, ) - if vm.is_running(): - vm.untrusted_qdb.write("/keyboard-layout", newvalue) - @qubes.ext.handler("domain-tag-add:created-by-*") def set_guivm_on_created_by(self, vm, event, tag, **kwargs): """Set GuiVM based on 'tag-created-vm-with' and 'set-created-guivm'