Core · wm
Portal WM — Window Manager Daemon
Daemon that monitors Wayland toplevel windows and assigns them to spatial zones. Uses ext_foreign_toplevel_list_v1 to track windows and IPC to send zone assignments to portal-spatial.
Architecture
Overview
portal-wm is the window manager daemon that bridges the Wayland compositor and the spatial zone system. It connects to Wayfire as a Wayland client, uses the ext_foreign_toplevel_list_v1 protocol to discover application windows (tracking their title, app_id, and identifier), and applies a zone assignment policy to determine which spatial zone each window should occupy. Zone assignments are then sent to the portal-spatial plugin via IPC at /run/portal/spatial.sock. The daemon runs as a systemd service (portal-wm.service) and gracefully handles missing IPC connections (logs a warning, continues tracking windows without zone assignment).
Key Types
Modules
main
Entry point — connects to Wayland, binds ext_foreign_toplevel_list_v1, enters event loop dispatching Wayland events and sending IPC assignments.
config
Configuration (future: per-app zone preferences, custom zone policies, dimension-specific layouts).
spatial_ipc
IPC client wrapper using portal-spatial — connects to /run/portal/spatial.sock, sends AssignZone messages.
zone_policy
Zone assignment policy engine — fills center first, then peripherals; utility apps prefer peripherals; stacking when all zones occupied.
Data Flow
Wayfire announces new toplevel → portal-wm tracks title/app_id → ZonePolicy assigns zone → IPC sends AssignZone to portal-spatial plugin → plugin applies spatial transform
Dependencies
Internal (2)
External (10)
Depends on portal-spatial (zone types, IPC protocol). External: wayland-client, wayland-protocols (foreign toplevel management), tokio (async runtime), tracing (logging).