-
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3070 add implementation that does not require a subprocess
- Loading branch information
Showing
1 changed file
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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) | ||
|