72 lines
1.7 KiB
Plaintext
72 lines
1.7 KiB
Plaintext
package moonplasma:wm@0.2.0;
|
|
|
|
interface policy {
|
|
use moonplasma:desktop/types@0.1.0.{rect, size, point};
|
|
|
|
type window-id = u64;
|
|
|
|
flags window-caps {
|
|
can-move,
|
|
can-resize,
|
|
can-maximize,
|
|
can-minimize,
|
|
can-fullscreen,
|
|
}
|
|
|
|
enum layout-mode {
|
|
floating,
|
|
tiling,
|
|
monocle,
|
|
}
|
|
|
|
record window-state {
|
|
id: window-id,
|
|
app-id: string,
|
|
title: string,
|
|
geometry: rect,
|
|
min-size: size,
|
|
max-size: option<size>,
|
|
focused: bool,
|
|
maximized: bool,
|
|
fullscreen: bool,
|
|
workspace: u32,
|
|
caps: window-caps,
|
|
}
|
|
|
|
variant window-request {
|
|
maximize(bool),
|
|
fullscreen(bool),
|
|
minimize(bool),
|
|
close,
|
|
activate,
|
|
move-to(point),
|
|
resize-to(size),
|
|
}
|
|
|
|
variant wm-action {
|
|
set-geometry(tuple<window-id, rect>),
|
|
focus(window-id),
|
|
raise(window-id),
|
|
close(window-id),
|
|
set-maximized(tuple<window-id, bool>),
|
|
set-fullscreen(tuple<window-id, bool>),
|
|
}
|
|
|
|
variant input-target {
|
|
client(tuple<window-id, point>),
|
|
decoration(tuple<window-id, point>),
|
|
shell-panel(point),
|
|
none,
|
|
}
|
|
|
|
/// Called on startup or WM hot-swap to synchronize existing windows.
|
|
sync-windows: func(outputs: list<rect>, windows: list<window-state>) -> list<wm-action>;
|
|
on-window-open: func(win: window-state, work-area: rect) -> list<wm-action>;
|
|
on-window-close: func(id: window-id) -> list<wm-action>;
|
|
on-window-request: func(id: window-id, req: window-request, work-area: rect) -> list<wm-action>;
|
|
on-pointer: func(pos: point, button: option<u32>, pressed: bool) -> input-target;
|
|
set-layout-mode: func(mode: layout-mode, work-area: rect) -> list<wm-action>;
|
|
/// Returns window IDs in bottom-to-top Z-order.
|
|
stacking-order: func() -> list<window-id>;
|
|
}
|