X11 dock bridge: show and control host EWMH windows under --x11
CI / test (push) Failing after 2m37s

Under --x11 with a host EWMH window manager (e.g. Openbox in Gamerig),
Chandra is one top-level X11 client while other apps run directly on Xorg,
so the dock only saw Chandra's Wayland windows.

- compositor/x11: intern EWMH/ICCCM atoms and track _NET_CLIENT_LIST,
  _NET_ACTIVE_WINDOW, titles, and window states via PropertyChangeMask,
  filtering non-taskbar/child windows and adding focus, close, minimize,
  and toggle-maximize EWMH/ICCCM actions.
- compositor/shell: add resolve_external_app_id (matching WM_CLASS and
  StartupWMClass against installed .desktop files) and publish_windows.
- compositor/host: bridge ExternalWindow entries with bit-30 tagged IDs
  into shell.windows/win_list while keeping Wayland wm.windows and session
  snapshots untouched, and route activate_task / window_command actions.
- compositor/app, compositor/bin, docs/x11.md: wire external window sync
  before X11 input handling and register ExternalWindowHandler.

Verified: moon test --target native compositor/x11 compositor/shell (38/38),
external_windows_test.mbt + dock_test.mbt (3/3), build-compositor-wasm.sh,
and moon build --target native compositor/bin.
This commit is contained in:
nandi committed 2026-11-27 14:33:26 -08:00
1 parent 15b7c3f0e3
commit 1871d50a3e
12 files changed
+949 -68

No files matched your search

+32
View File
@@ -170,6 +170,21 @@ fn main {
Some(k) => comp.server.set_keymap(k.keymap)
None => ()
}
match xwin {
Some(x) =>
comp.set_external_window_handler({
focus: fn(xid) { x.focus_external(xid) },
command: fn(xid, cmd) {
match cmd {
Close => x.close_external(xid)
Minimize => x.minimize_external(xid)
Restore => x.focus_external(xid)
ToggleMaximize => x.toggle_maximize_external(xid)
}
},
})
None => ()
}
println("chandra compositor listening on " + socket_path + " (wasi-gfx surface active)")
// chandra-ctl's socket (reload panel modules from a script); SIGUSR1 reloads too.
ignore(comp.start_control(@host.control_socket_path(@sys.getenv("XDG_RUNTIME_DIR"), socket_path)))
@@ -241,6 +256,23 @@ fn main {
if x.keymap.length() > 0 {
comp.server.set_keymap(x.keymap)
}
match x.take_external_windows() {
Some(ext) =>
comp.set_external_windows(
ext.map(fn(w) -> @host.ExternalWindow {
{
host_id: w.xid,
wm_class: w.wm_class,
wm_instance: w.wm_instance,
title: w.title,
focused: w.focused,
minimized: w.minimized,
maximized: w.maximized,
}
}),
)
None => ()
}
match x.take_resize() {
Some((nw, nh)) => comp.resize(nw, nh)
None => ()