Skip to content

Commit

Permalink
#3070 add implementation that does not require a subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Apr 14, 2021
1 parent 4ca9e0e commit 8383233
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion xpra/platform/xposix/keyboard.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# This file is part of Xpra.
# Copyright (C) 2010 Nathaniel Smith <[email protected]>
# Copyright (C) 2011-2020 Antoine Martin <[email protected]>
# Copyright (C) 2011-2021 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import os

from xpra.platform.keyboard_base import KeyboardBase
from xpra.keyboard.mask import MODIFIER_MAP
from xpra.keyboard.layouts import xkbmap_query_tostring
Expand Down Expand Up @@ -129,6 +131,18 @@ def get_xkb_rules_names_property(self):


def get_all_x11_layouts(self):
import lxml.etree
repository = "/usr/share/X11/xkb/rules/base.xml"
if os.path.exists(repository):
with open(repository) as f:
tree = lxml.etree.parse(f)
x11_layouts = {}
for layout in tree.xpath("//layout"):
layout = layout.xpath("./configItem/name")[0].text
x11_layouts[layout] = layout
#for variant in layout.xpath("./variantList/variant/configItem/name"):
# variant_name = variant.text
return x11_layouts
from subprocess import Popen, PIPE
try:
proc = Popen(["localectl", "list-x11-keymap-layouts"], stdout=PIPE, stderr=PIPE)
Expand Down

0 comments on commit 8383233

Please sign in to comment.