- tools/nested-session.sh (Xvfb -> nested niri, own display/runtime dir, xresize for SMOKE_SIZE); smoke.sh and hidden.sh run in it; wl-input moved to tools/wl-input (own crate) - selftest: click/rclick/pagescroll via wl-input, pagetype via wtype, resize via the nested niri - WebKit sandbox: XDG user dirs (+ test pages in scripted runs) read-only so file:// media plays (D-043) - SMOKE_VISIBLE needs the user's niri window rule, never moves focus (D-044) - launch, basics, input, keys, chrome green hidden Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
1.4 KiB
Python
29 lines
1.4 KiB
Python
"""Resize every mapped top-level window of an X display (Xvfb has no window manager): xresize.py :N W H.
|
|
|
|
tools/nested-session.sh uses it to give niri's winit output the requested size. Plain ctypes over libX11.
|
|
"""
|
|
import ctypes
|
|
import sys
|
|
|
|
x = ctypes.CDLL("libX11.so.6")
|
|
x.XOpenDisplay.restype = ctypes.c_void_p
|
|
x.XOpenDisplay.argtypes = [ctypes.c_char_p]
|
|
x.XDefaultRootWindow.restype = ctypes.c_ulong
|
|
x.XDefaultRootWindow.argtypes = [ctypes.c_void_p]
|
|
x.XQueryTree.argtypes = [ctypes.c_void_p, ctypes.c_ulong, ctypes.POINTER(ctypes.c_ulong), ctypes.POINTER(ctypes.c_ulong),
|
|
ctypes.POINTER(ctypes.POINTER(ctypes.c_ulong)), ctypes.POINTER(ctypes.c_uint)]
|
|
x.XResizeWindow.argtypes = [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_uint, ctypes.c_uint]
|
|
x.XSync.argtypes = [ctypes.c_void_p, ctypes.c_int]
|
|
x.XCloseDisplay.argtypes = [ctypes.c_void_p]
|
|
|
|
display, w, h = sys.argv[1], int(sys.argv[2]), int(sys.argv[3])
|
|
d = x.XOpenDisplay(display.encode())
|
|
if not d:
|
|
sys.exit(f"xresize: can't open {display}")
|
|
root, parent, children, n = ctypes.c_ulong(), ctypes.c_ulong(), ctypes.POINTER(ctypes.c_ulong)(), ctypes.c_uint()
|
|
x.XQueryTree(d, x.XDefaultRootWindow(d), ctypes.byref(root), ctypes.byref(parent), ctypes.byref(children), ctypes.byref(n))
|
|
for i in range(n.value):
|
|
x.XResizeWindow(d, children[i], w, h)
|
|
x.XSync(d, 0)
|
|
x.XCloseDisplay(d)
|
|
print(f"xresize: {n.value} window(s) to {w}x{h}")
|