feat: add XKB layout indicator, live X11 session replace, and ANODE WM/DE identity
This commit is contained in:
1 parent
8d6236a63f
commit
158345c168
12 files changed
+1303
-48
No files matched your search
+38
-3
@@ -4,6 +4,7 @@
|
||||
import ctypes
|
||||
import ctypes.util
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import signal
|
||||
import socket
|
||||
@@ -101,6 +102,8 @@ X11.XGetWMHints.argtypes = [Display_p, Window]
|
||||
X11.XGetWMHints.restype = ctypes.POINTER(XWMHints)
|
||||
X11.XFetchName.argtypes = [Display_p, Window, ctypes.POINTER(ctypes.c_char_p)]
|
||||
X11.XFetchName.restype = ctypes.c_int
|
||||
X11.XkbLockGroup.argtypes = [Display_p, ctypes.c_uint, ctypes.c_uint]
|
||||
X11.XkbLockGroup.restype = ctypes.c_int
|
||||
|
||||
|
||||
def pick_display():
|
||||
@@ -270,10 +273,11 @@ def test_resolution(res_str, scale_str, width, height):
|
||||
assert wait_until(lambda: (lambda w: w if w and len(w) >= 4 and w[3] < wa0[3] else None)(get_cardinal_prop(dpy, root, "_NET_WORKAREA"))), "Workarea did not re-reserve on vkbd show"
|
||||
terminate(vkbd)
|
||||
|
||||
# Test anode-statusd updates root WM_NAME
|
||||
# Test anode-statusd updates root WM_NAME and tracks XKB layout left of datetime
|
||||
sd = subprocess.Popen([os.path.join(BUILD, "daemons", "anode-statusd")], env=env)
|
||||
procs.append(sd)
|
||||
def has_status():
|
||||
|
||||
def get_status():
|
||||
nm = ctypes.c_char_p()
|
||||
if X11.XFetchName(dpy, root, ctypes.byref(nm)) and nm.value:
|
||||
s = nm.value.decode("utf-8", errors="ignore")
|
||||
@@ -281,7 +285,38 @@ def test_resolution(res_str, scale_str, width, height):
|
||||
if "|" in s:
|
||||
return s
|
||||
return None
|
||||
assert wait_until(has_status), "anode-statusd did not publish status to root WM_NAME"
|
||||
|
||||
def get_kbd_left_of_dt():
|
||||
s = get_status()
|
||||
if not s:
|
||||
return None
|
||||
parts = [p.strip() for p in s.split("|")]
|
||||
if len(parts) < 4:
|
||||
return None
|
||||
if not re.fullmatch(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}", parts[-1]):
|
||||
return None
|
||||
kbd = parts[-2]
|
||||
if not kbd or not kbd.isascii() or not kbd.isalnum() or kbd != kbd.lower():
|
||||
return None
|
||||
return kbd
|
||||
|
||||
init_kbd = wait_until(get_kbd_left_of_dt)
|
||||
assert init_kbd, f"anode-statusd missing lowercase XKB layout left of datetime: {get_status()!r}"
|
||||
if shutil.which("setxkbmap"):
|
||||
subprocess.run(
|
||||
["setxkbmap", "-layout", "us,de,ru", "-variant", ",nodeadkeys,"],
|
||||
env=env, check=True,
|
||||
)
|
||||
assert wait_until(lambda: get_kbd_left_of_dt() == "us"), f"Expected 'us': {get_status()!r}"
|
||||
X11.XkbLockGroup(dpy, 0x0100, 1)
|
||||
X11.XSync(dpy, 0)
|
||||
assert wait_until(lambda: get_kbd_left_of_dt() == "de"), f"Expected 'de': {get_status()!r}"
|
||||
X11.XkbLockGroup(dpy, 0x0100, 2)
|
||||
X11.XSync(dpy, 0)
|
||||
assert wait_until(lambda: get_kbd_left_of_dt() == "ru"), f"Expected 'ru': {get_status()!r}"
|
||||
X11.XkbLockGroup(dpy, 0x0100, 0)
|
||||
X11.XSync(dpy, 0)
|
||||
assert wait_until(lambda: get_kbd_left_of_dt() == "us"), f"Expected 'us' restore: {get_status()!r}"
|
||||
terminate(sd)
|
||||
|
||||
# Test core + GemUI utilities launch, map cleanly inside screen, and exit cleanly
|
||||
|
||||
Reference in new issue
Block a user