Documentation
    Preparing search index...

    Interface LayoutStrategy

    Pure function contract for consumer layout strategies. (D1) No side effects. Implement this in your shell repo — @kehto/wm ships only the contract.

    // In your shell repo (not in @kehto/wm):
    import type { LayoutStrategy, WindowState, Rect } from '@kehto/wm';

    export const myBspStrategy: LayoutStrategy = {
    arrange(windows, containerRect) {
    const visible = windows.filter(w => !w.minimized);
    if (visible.length === 0) return [];
    const w = Math.floor(containerRect.w / visible.length);
    return visible.map((win, i) => ({
    id: win.id,
    rect: { x: containerRect.x + i * w, y: containerRect.y, w, h: containerRect.h },
    }));
    },
    };
    interface LayoutStrategy {
        arrange(
            windows: readonly WindowState[],
            containerRect: Rect,
        ): readonly WindowPlacement[];
    }
    Index

    Methods

    Methods