gui: handle legacy keymap setting /qubes-keyboard

This commit is contained in:
Frédéric Pierret (fepitre) 2020-02-10 14:42:30 +01:00
parent c332de9653
commit dbacd07b43
No known key found for this signature in database
GPG Key ID: 484010B5CDC576E2

View File

@ -21,6 +21,8 @@
# License along with this library; if not, see <https://www.gnu.org/licenses/>.
#
import subprocess
import qubes.config
import qubes.ext
@ -79,6 +81,16 @@ 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)
if xkb_keymap.stdout:
vm.untrusted_qdb.write('/qubes-keyboard', xkb_keymap.stdout)
except FileNotFoundError:
# Prevent any reason for 'setxkbmap' being not present
pass
# Set GuiVM prefix
guivm_windows_prefix = vm.features.get('guivm-windows-prefix', 'GuiVM')
if vm.features.get('service.guivm-gui-agent', None):