Aulinx Compositor Architecture (Revised)

Built with Smithay 0.7 — verified against COSMIC, niri, and Anvil

System Architecture
User Layer
Wayland Apps
foot, GTK, Qt
X11 Apps
Firefox, Electron
AI Palette
Layer Shell client
Panels / Bars
Layer Shell clients
Wayland Protocols
xdg-shell
layer-shell
xdg-decor
dmabuf
viewporter
frac-scale
session-lock
virt-keyboard
virt-pointer
ptr-constrain
idle-notify
data-control
Compositor Core (Rust)
AulinxState
• All Smithay delegates
• Space<WindowElement>
• Seat + Keyboard + Pointer
• Workspaces (Super+1..9)
• Window registry (id → meta)
• BackendData enum
Layout Engine
• N-ary tree (id_tree)
• Group nodes (H/V split)
• Mapped nodes (windows)
• Floating z-stack
• Auto-float dialogs
IPC Server
• UnixListener on calloop
• Newline JSON-RPC
• windows.* (5 cmds)
• input.* (3 cmds)
• screen.capture
Shell
xdg.rs — toplevels/popups
layer.rs — AI palette overlay
decoration.rs — SSD title bars
Input
mod.rs — physical kbd/mouse
injection.rs — AI virtual input
Uses zwp_virtual_keyboard_v1
Render
Glow/OpenGL primary
Multi-renderer support
Damage tracking
XWayland
X11Wm + XwmHandler — X11 app compat
Calloop Event Loop (single-threaded)
Wayland fd • Backend events • IPC socket • XWayland • Timers
▼ Unix Socket — /run/aulinx/ai.sock — JSON-RPC ▼
Python Agent (151 tools)
Ollama LLM • AT-SPI • CLI • WebSocket UI • Voice • MCP Server
Backend Layer
Winit Backend
Development mode
Nested in GNOME/other WM
Immediate visual feedback
DRM/KMS + Udev + Libinput
Production mode
LibSeat session management
Multi-monitor, VT switching

Module Structure

compositor/src/
main.rs — entry point, backend selection, event loop run
state.rs — AulinxState + Smithay delegate_*! macros
window.rs — WindowElement enum (Wayland | X11)
workspace.rs — workspace switching, window assignment
focus.rs — keyboard + pointer focus tracking
cursor.rs — xcursor theme loading
xwayland.rs — XWayland spawn + X11Wm + XwmHandler
config.rs — runtime config (paths, defaults)
backend/ mod.rs + winit.rs + udev.rs
shell/ mod.rs + xdg.rs + layer.rs + decoration.rs
layout/ mod.rs + tiling.rs (n-ary tree) + floating.rs
ipc/ mod.rs + protocol.rs + handlers.rs
input/ mod.rs + injection.rs
render/ mod.rs + renderer.rs

Data Flow

How an AI command flows through the system
1.
Python agent sends {"method":"windows.list"} over Unix socket
2.
Calloop wakes on socket readable → IPC server reads + parses JSON-RPC
3.
handlers.rs dispatches to handle_windows_list(&state)
4.
Handler iterates state.windows HashMap → builds response array
5.
JSON-RPC response written back to client socket
6.
Python agent receives [{id:1, title:"foot", x:0, y:0, ...}]
1.
Python sends {"method":"input.type","params":{"text":"hello"}}
2.
IPC handler calls injection::type_text(&mut state, "hello")
3.
injection.rs generates virtual key events via zwp_virtual_keyboard_v1
4.
Key events delivered to focused Wayland client → text appears