windowmanager

package
v0.7.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package windowmanager owns workspace-scoped window topology and semantic mutations.

Index

Constants

View Source
const (
	NewWindowInsert            NewWindowPolicy     = "beside_focus"
	NewWindowTab               NewWindowPolicy     = "tab"
	SmallViewportStack         SmallViewportPolicy = "stack"
	SmallViewportReject        SmallViewportPolicy = "reject"
	FocusClickDirectional      FocusPolicy         = "click_directional"
	FocusDirectional           FocusPolicy         = "directional"
	DragAwayWindow             DragAwayPolicy      = "window"
	DragAwayGroup              DragAwayPolicy      = "group"
	DesktopTransitionSlide     DesktopTransition   = "slide"
	DesktopTransitionCrossfade DesktopTransition   = "crossfade"
	DesktopTransitionInstant   DesktopTransition   = "instant"
)
View Source
const DefaultGlobalSummonChord = "meta+shift+Space"
View Source
const DefaultGlobalSummonCommandID = "palette.summon.global"
View Source
const LayoutResourceVersion uint32 = 1

LayoutResourceVersion is the schema version required for a declarative window_layout resource.

View Source
const LegacySnapshotVersion uint32 = 3

LegacySnapshotVersion is the last stored aggregate shape that marked the desktop zoom created with a purpose and owner instead of flagging the window.

View Source
const MaxWireRevision uint64 = 1<<53 - 1

MaxWireRevision is the largest revision exactly representable by JSON clients.

View Source
const PreviousSnapshotVersion uint32 = 4
View Source
const SnapshotVersion uint32 = 6
View Source
const (
	WindowLayoutResourceKind resources.ResourceKind = "window_layout"
)

Variables

View Source
var (
	ErrUnavailable                   = errors.New("window manager unavailable")
	ErrWindowBindingInvalid          = errors.New("window_binding_invalid")
	ErrWorkspaceNotFound             = errors.New("window manager workspace not found")
	ErrSnapshotNotFound              = errors.New("window manager snapshot not found")
	ErrRevisionConflict              = errors.New("window manager revision conflict")
	ErrInvalidCommand                = errors.New("window manager invalid command")
	ErrInvalidTopology               = errors.New("window manager invalid topology")
	ErrDesktopNotFound               = errors.New("window manager desktop not found")
	ErrWindowNotFound                = errors.New("window manager window not found")
	ErrClientNotFound                = errors.New("window manager client not found")
	ErrClientUnauthorized            = errors.New("window manager client unauthorized")
	ErrClientDisconnected            = errors.New("window manager client disconnected")
	ErrClientCommandTimedOut         = errors.New("window manager client command timed out")
	ErrDestinationRequired           = errors.New("window manager destination required")
	ErrFinalDesktop                  = errors.New("window manager final desktop")
	ErrHistoryBoundary               = errors.New("window manager history boundary")
	ErrLayoutResourceNotFound        = errors.New("window manager layout resource not found")
	ErrSlowConsumer                  = errors.New("window manager slow consumer")
	ErrPresentationRevisionExhausted = errors.New("window manager presentation revision exhausted")
	ErrContextRevisionExhausted      = errors.New("window manager context revision exhausted")
	ErrTopologyRevisionExhausted     = errors.New("window manager topology revision exhausted")
	ErrClosed                        = errors.New("window manager closed")
	ErrWindowPinned                  = errors.New("window manager window pinned")
)

Functions

func CanonicalGlobalShortcuts

func CanonicalGlobalShortcuts(
	source map[string]string,
	bindableIDs BindableIDs,
) (map[string]string, error)

CanonicalGlobalShortcuts validates intended bindings against one catalog snapshot.

func CanonicalShortcutChord

func CanonicalShortcutChord(chord string) (string, error)

CanonicalShortcutChord validates one manifest or config chord with the daemon grammar.

func CanonicalShortcutsV2

func CanonicalShortcutsV2(
	overrides map[string]ShortcutBinding,
	bindableIDs BindableIDs,
) (map[string]ShortcutBinding, error)

CanonicalShortcutsV2 validates overrides, expands range families, and rejects collisions against both other overrides and daemon-owned defaults.

func CanonicalShortcutsV2Retaining

func CanonicalShortcutsV2Retaining(
	overrides map[string]ShortcutBinding,
	retained map[string]ShortcutBinding,
	bindableIDs BindableIDs,
) (map[string]ShortcutBinding, error)

CanonicalShortcutsV2Retaining validates a keymap mutation like CanonicalShortcutsV2, except that a chord the retained (stored) overrides already took from a daemon default may keep displacing it, whichever action claims it now, so moving such a chord between commands never revives the default. A chord newly recorded onto another action's default still conflicts.

func CanonicalStoredGlobalShortcuts

func CanonicalStoredGlobalShortcuts(source map[string]string) (map[string]string, error)

CanonicalStoredGlobalShortcuts validates syntax and collisions without a live catalog.

func CanonicalStoredShortcutsV2

func CanonicalStoredShortcutsV2(
	overrides map[string]ShortcutBinding,
) (map[string]ShortcutBinding, error)

CanonicalStoredShortcutsV2 validates grammar and stored collisions without a live catalog.

func CloneGlobalShortcutMap

func CloneGlobalShortcutMap(source map[string]string) map[string]string

CloneGlobalShortcutMap returns an ownership-safe copy of intended global bindings.

func CloneShortcutMap

func CloneShortcutMap(source map[string]ShortcutBinding) map[string]ShortcutBinding

CloneShortcutMap returns an ownership-safe copy of a shortcut map and its bindings.

func CommandAlias

func CommandAlias(id string) (string, bool)

CommandAlias translates the two public window IDs removed in v0.8.0.

func ConvertSnapshotV5

func ConvertSnapshotV5(legacy SnapshotV5) (Snapshot, MigrationSummary, error)

ConvertSnapshotV5 preserves every content instance and rejects ambiguous membership.

func DecodeSnapshot

func DecodeSnapshot(encoded []byte) (Snapshot, MigrationSummary, error)

DecodeSnapshot permanently upgrades stored formats without changing current snapshots.

func DecodeWorkspaceConfigJSON

func DecodeWorkspaceConfigJSON(data []byte) (WorkspaceConfig, []Deprecation, error)

DecodeWorkspaceConfigJSON returns effective overrides and separate input deprecations until v0.8.0.

func DefaultKeymap

func DefaultKeymap() map[string]ShortcutBinding

DefaultKeymap returns the daemon-owned v2 keymap.

func EffectiveKeymap

func EffectiveKeymap(
	overrides map[string]ShortcutBinding,
	bindableIDs BindableIDs,
) (map[string]ShortcutBinding, error)

EffectiveKeymap merges override-wins bindings into daemon defaults and validates the whole map.

func EffectiveStoredKeymap

func EffectiveStoredKeymap(
	overrides map[string]ShortcutBinding,
) (map[string]ShortcutBinding, error)

EffectiveStoredKeymap resolves a trusted stored map without catalog membership checks. Stored overrides win over a default that later shipped on one of their chords.

func IsReservedDesktopPartition

func IsReservedDesktopPartition(id WorkspaceID) bool

IsReservedDesktopPartition identifies partitions that do not require a project registration.

func NewLayoutResourceCodec

func NewLayoutResourceCodec(observers ...AppDeprecationObserver) (resources.KindCodec[LayoutResource], error)

NewLayoutResourceCodec constructs the strict declarative window-layout codec.

func RebindWorkspace

func RebindWorkspace(snapshot *Snapshot, from string, to string) bool

RebindWorkspace rewrites every retained window binding from one workspace reference to another: current routes, navigation stacks, closed entries, and undo/redo states. Migrations use it when the bound work itself moves to a new scope, so migrated windows keep opening the same items instead of being retired as stale bindings.

func RetiredApp

func RetiredApp(app string) (string, bool)

RetiredApp remains part of the lossless stored-snapshot migration.

func RetiredConfigWarning

func RetiredConfigWarning(key string, translated bool) string

RetiredConfigWarning is the operator-facing warning for a v0.7 config shim.

func RetiredPaletteCommand

func RetiredPaletteCommand(id string) bool

func RetiredPaletteCommandIDs

func RetiredPaletteCommandIDs() []string

RetiredPaletteCommandIDs remain invocable as no-ops until v0.8.0.

func RetiredShortcut

func RetiredShortcut(id string) bool

RetiredShortcut accepts stored bindings without assigning any action until v0.8.0.

func TolerantEffectiveKeymapWithExtensionDefaults

func TolerantEffectiveKeymapWithExtensionDefaults(
	overrides map[string]ShortcutBinding,
	bindableIDs BindableIDs,
	defaults []ExtensionDefaultShortcut,
) (map[string]ShortcutBinding, []ExtensionDefaultStatus, []ShortcutDiagnostic, error)

TolerantEffectiveKeymapWithExtensionDefaults applies the extension tier after core defaults and user overrides, preserving every dormant claim for settings.

func ValidateSnapshot

func ValidateSnapshot(snapshot Snapshot) error

ValidateSnapshot checks every committed aggregate invariant without repairing input.

func WarnRetiredConfigKey

func WarnRetiredConfigKey(key string, translated bool)

WarnRetiredConfigKey reports a boundary translation once per process until v0.8.0.

func WarnSurfaceDeprecation

func WarnSurfaceDeprecation(
	ctx context.Context, logger *slog.Logger, entry Deprecation, actorKind string, seen *sync.Map,
)

WarnSurfaceDeprecation logs once per surface until v0.8.0; nil seen uses the daemon process lifetime.

Types

type ActivateTabCommand

type ActivateTabCommand struct {
	WindowID WindowID `json:"window_id"`
}

func (ActivateTabCommand) CommandID

func (ActivateTabCommand) CommandID() CommandID

type Actor

type Actor struct {
	Kind string `json:"kind,omitempty"`
	ID   string `json:"id,omitempty"`
}

Actor records the initiator without affecting command semantics.

type AppDeprecationObserver

type AppDeprecationObserver func(ctx context.Context, app, replacement, source string)

type ArrangeLayoutCommand

type ArrangeLayoutCommand struct {
	DesktopID   DesktopID
	WindowIDs   []WindowID
	Arrangement Arrangement
	Frame       NormalizedRect
	GroupID     GroupID
	ResourceID  string
	// KeepFrames is ignored at the compatibility boundary through v0.7.
	KeepFrames bool
}

func (ArrangeLayoutCommand) CommandID

func (ArrangeLayoutCommand) CommandID() CommandID

type Arrangement

type Arrangement string
const (
	ArrangementHorizontal Arrangement = "horizontal"
	ArrangementVertical   Arrangement = "vertical"
	ArrangementGrid       Arrangement = "grid"
	ArrangementStack      Arrangement = "stack"
	// ArrangementMainStack gives the first participant the main column and
	// splits the remaining participants vertically in the side column.
	ArrangementMainStack Arrangement = "main_stack"
)

type Axis

type Axis string
const (
	AxisHorizontal Axis = "horizontal"
	AxisVertical   Axis = "vertical"
)

type BalanceLayoutCommand

type BalanceLayoutCommand struct {
	TabID   *TabID
	GroupID *GroupID
	SplitID *NodeID
}

func (BalanceLayoutCommand) CommandID

func (BalanceLayoutCommand) CommandID() CommandID

type BindableIDs

type BindableIDs map[string]struct{}

BindableIDs is the command-catalog snapshot accepted by keymap mutations.

func DefaultBindableIDs

func DefaultBindableIDs() BindableIDs

DefaultBindableIDs returns the ids carried by the daemon's shipped keymap.

func NewBindableIDs

func NewBindableIDs(ids []string) BindableIDs

NewBindableIDs builds an ownership-safe command-id set.

type BindingsConfig

type BindingsConfig struct {
	TopCenter    string `json:"top_center"`
	BottomCenter string `json:"bottom_center"`
}

BindingsConfig maps special snap regions to window-manager actions.

type ChangeSet

type ChangeSet struct {
	TabIDs         []TabID     `json:"tab_ids,omitempty"`
	TabSplit       []TabID     `json:"tab_split,omitempty"`
	TabUnsplit     []TabID     `json:"tab_unsplit,omitempty"`
	DesktopIDs     []DesktopID `json:"desktop_ids,omitempty"`
	WindowIDs      []WindowID  `json:"window_ids,omitempty"`
	GroupIDs       []GroupID   `json:"group_ids,omitempty"       deprecated:"true"`
	NodeIDs        []NodeID    `json:"node_ids,omitempty"`
	ClientIDs      []ClientID  `json:"client_ids,omitempty"`
	StackGrouped   []NodeID    `json:"stack_grouped,omitempty"   deprecated:"true"`
	StackUngrouped []NodeID    `json:"stack_ungrouped,omitempty" deprecated:"true"`
}

ChangeSet names the entities affected by one command.

type ClientCommand

type ClientCommand struct {
	CommandID string          `json:"command_id"`
	Op        string          `json:"op"`
	Payload   json.RawMessage `json:"payload,omitempty"`
}

ClientCommand is one invocation the daemon dispatches to an attached client.

type ClientCommandConnection

type ClientCommandConnection interface {
	Commands() <-chan ClientCommand
	Done() <-chan struct{}
	Err() error
	Resolve(ClientCommandResponse) error
	Close() error
}

ClientCommandConnection is the live channel used to dispatch and resolve commands.

type ClientCommandResponse

type ClientCommandResponse struct {
	CommandID string                      `json:"command_id"`
	Status    ClientCommandResponseStatus `json:"status"`
	Result    json.RawMessage             `json:"result,omitempty"`
	Error     string                      `json:"error,omitempty"`
}

ClientCommandResponse is the client's ack, result, or error for one command.

type ClientCommandResponseStatus

type ClientCommandResponseStatus string

ClientCommandResponseStatus is the ack, result, or error stage of one command.

const (
	ClientCommandAcknowledged ClientCommandResponseStatus = "ack"
	ClientCommandCompleted    ClientCommandResponseStatus = "result"
	ClientCommandFailed       ClientCommandResponseStatus = "error"
)

type ClientContextInput

type ClientContextInput struct {
	ScopeGlobal         bool
	FocusedSessionState string
	WorkspaceTrusted    bool
	DestinationIntent   *RouteIntent
	GlobalShortcuts     []GlobalShortcutRegistration
}

ClientContextInput carries only client-owned volatile palette state.

type ClientContextUpdate

type ClientContextUpdate struct {
	WorkspaceID WorkspaceID
	ClientID    ClientID
	Context     ClientContextInput
}

ClientContextUpdate replaces one attached client's palette and global-shortcut context.

type ClientID

type ClientID string

type ClientKind

type ClientKind string
const (
	ClientKindShell   ClientKind = "shell"
	ClientKindBrowser ClientKind = "browser"
)

type ClientRegistration

type ClientRegistration struct {
	WorkspaceID     WorkspaceID
	ClientID        ClientID
	Kind            ClientKind
	ActiveDesktopID DesktopID
	Context         ClientContextInput
}

ClientRegistration requests a live client view.

type ClientUnregisteredObserver

type ClientUnregisteredObserver func(context.Context, WorkspaceID, ClientID) error

ClientUnregisteredObserver tears down transient state owned by a detached client.

type ClientView

type ClientView struct {
	WorkspaceID          WorkspaceID                  `json:"workspace_id"`
	ClientID             ClientID                     `json:"client_id"`
	Kind                 ClientKind                   `json:"kind"`
	PresentationRevision uint64                       `json:"presentation_revision"`
	ContextRevision      uint64                       `json:"context_revision"`
	ActiveDesktopID      DesktopID                    `json:"active_desktop_id"`
	FocusedWindowID      *WindowID                    `json:"focused_window_id,omitzero"`
	FocusOrder           []WindowID                   `json:"focus_order"`
	ActiveTab            map[DesktopID]TabID          `json:"active_tab"`
	StackActive          map[NodeID]WindowID          `json:"stack_active"               deprecated:"true"`
	PaletteContext       PaletteContext               `json:"palette_context"`
	GlobalShortcuts      []GlobalShortcutRegistration `json:"global_shortcuts"`
	ConnectedAt          time.Time                    `json:"connected_at"`
	AttachmentToken      string                       `json:"attachment_token,omitempty"`
}

ClientView is transient presentation state for one connected client.

type CloseScope

type CloseScope string
const (
	CloseScopeTab    CloseScope = ""
	CloseScopeGroup  CloseScope = "group"
	CloseScopeOthers CloseScope = "others"
	CloseScopeRight  CloseScope = "right"
	CloseScopeLeft   CloseScope = "left"
	CloseScopeAll    CloseScope = "all"
)

type CloseWindowCommand

type CloseWindowCommand struct {
	WindowID WindowID   `json:"window_id"`
	Minimize bool       `json:"minimize,omitzero"`
	Scope    CloseScope `json:"scope,omitempty"`
}

CloseWindowCommand retains retired request fields through v0.7.0.

func (CloseWindowCommand) CommandID

func (CloseWindowCommand) CommandID() CommandID

type ClosedEntry

type ClosedEntry struct {
	Windows   []Window      `json:"windows"`
	Tabs      []ClosedTab   `json:"tabs,omitempty"`
	Member    *ClosedMember `json:"member,omitzero"`
	DesktopID DesktopID     `json:"desktop_id"`
	ClosedAt  time.Time     `json:"closed_at"`
}

type ClosedEntryV5

type ClosedEntryV5 struct {
	Windows   []WindowV5     `json:"windows"`
	ActiveID  *WindowID      `json:"active_id,omitzero"`
	StackID   *NodeID        `json:"stack_id,omitzero"`
	DesktopID DesktopID      `json:"desktop_id"`
	Rect      NormalizedRect `json:"rect"`
	ClosedAt  time.Time      `json:"closed_at"`
}

type ClosedMember

type ClosedMember struct {
	TabID         TabID    `json:"tab_id"`
	ParentSplitID NodeID   `json:"parent_split_id"`
	ChildIndex    int      `json:"child_index"`
	Weight        float64  `json:"weight"`
	NeighborID    WindowID `json:"neighbor_id"`
	NeighborEdge  Edge     `json:"neighbor_edge"`
	// NeighborIDs lists, in layout order, the windows of the sibling branch when
	// it was a split. Reopen restores the member beside that whole branch while
	// the same windows still sit together; records without it fall back to
	// NeighborID alone.
	NeighborIDs []WindowID `json:"neighbor_ids,omitempty"`
}

type ClosedTab

type ClosedTab struct {
	ID     TabID      `json:"id"`
	Pinned bool       `json:"pinned"`
	Root   LayoutNode `json:"root"`
	Index  int        `json:"index"`
}

type Command

type Command interface {
	CommandID() CommandID
}

Command is one typed semantic mutation payload.

type CommandID

type CommandID string
const (
	CommandDesktopCreate        CommandID = "desktop.create"
	CommandDesktopUpdate        CommandID = "desktop.update"
	CommandDesktopReorder       CommandID = "desktop.reorder"
	CommandDesktopSwitch        CommandID = "desktop.switch"
	CommandDesktopDelete        CommandID = "desktop.delete"
	CommandWindowOpen           CommandID = "window.open"
	CommandWindowNavigate       CommandID = "window.navigate"
	CommandWindowClose          CommandID = "window.close"
	CommandWindowFocus          CommandID = "window.focus"
	CommandWindowMove           CommandID = "window.move"
	CommandWindowResize         CommandID = "window.resize"
	CommandWindowSwap           CommandID = "window.swap"
	CommandWindowToggleFloating CommandID = "window.toggle_floating"
	CommandWindowZoom           CommandID = "window.zoom"
	CommandWindowStackGroup     CommandID = "window.stack.group"
	CommandWindowStackReorder   CommandID = "window.stack.reorder"
	CommandWindowStackSetActive CommandID = "window.stack.set_active"
	CommandWindowTabReorder     CommandID = "window.tab.reorder"
	CommandWindowTabActivate    CommandID = "window.tab.activate"
	CommandWindowPin            CommandID = "window.pin"
	CommandWindowReopen         CommandID = "window.reopen"
	CommandLayoutArrange        CommandID = "layout.arrange"
	CommandLayoutResize         CommandID = "layout.resize"
	CommandLayoutFrameResize    CommandID = "layout.frame_resize"
	CommandLayoutBalance        CommandID = "layout.balance"
	CommandLayoutUndo           CommandID = "layout.undo"
	CommandLayoutRedo           CommandID = "layout.redo"
	CommandLayoutReplace        CommandID = "layout.replace"
)

func CommandIDs

func CommandIDs() []CommandID

CommandIDs returns every daemon semantic window-manager action ID.

type CommandRequest

type CommandRequest struct {
	WorkspaceID      WorkspaceID
	CommandID        CommandID
	ExpectedRevision Revision
	// ClientID is required for desktop.switch and window.focus.
	ClientID *ClientID
	Actor    Actor
	Origin   string
	Rebase   *RebaseGuard
	Payload  Command
}

CommandRequest binds one semantic command to a workspace revision.

type Commit

type Commit struct {
	WorkspaceID      WorkspaceID
	ExpectedRevision Revision
	Snapshot         Snapshot
	Event            Event
}

Commit is the repository's atomic compare-and-swap unit.

type Config

type Config struct {
	NewWindowPolicy     NewWindowPolicy            `json:"new_window_policy"`
	SmallViewportPolicy SmallViewportPolicy        `json:"small_viewport_policy"`
	FocusPolicy         FocusPolicy                `json:"focus_policy"`
	FocusWrap           bool                       `json:"focus_wrap"`
	FocusFollowsPointer bool                       `json:"focus_follows_pointer"`
	SwapModifier        string                     `json:"swap_modifier"`
	HistoryLimit        int                        `json:"history_limit"`
	NavStackLimit       int                        `json:"nav_stack_limit"`
	ClosedEntryLimit    int                        `json:"closed_entry_limit"`
	DesktopTransition   DesktopTransition          `json:"desktop_transition"`
	Gaps                GapsConfig                 `json:"gaps"`
	Shortcuts           map[string]ShortcutBinding `json:"shortcuts,omitempty"`
}

Config is the effective global window-manager configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns production defaults from the accepted contract.

type Conflict

type Conflict struct {
	Code      string `json:"code"`
	EntityID  string `json:"entity_id,omitempty"`
	CurrentID string `json:"current_id,omitempty"`
}

Conflict identifies one stale reference that prevented a safe rebase.

type CreateDesktopCommand

type CreateDesktopCommand struct {
	DesktopID DesktopID
	Name      string
	AfterID   *DesktopID
}

func (CreateDesktopCommand) CommandID

func (CreateDesktopCommand) CommandID() CommandID

type DeleteDesktopCommand

type DeleteDesktopCommand struct {
	DesktopID     DesktopID
	DestinationID *DesktopID
}

func (DeleteDesktopCommand) CommandID

func (DeleteDesktopCommand) CommandID() CommandID

type Deprecation

type Deprecation struct {
	Code           string `json:"code"`
	Surface        string `json:"surface"`
	Replacement    string `json:"replacement,omitempty"`
	RemovalRelease string `json:"removal_release"`
	Message        string `json:"message"`
}

func RetiredConfigDeprecation

func RetiredConfigDeprecation(key string, translated bool) Deprecation

RetiredConfigDeprecation describes a config translation until v0.8.0.

func SurfaceDeprecation

func SurfaceDeprecation(surface string) Deprecation

SurfaceDeprecation describes the v0.7 compatibility shim removed in v0.8.0.

type DeprecationObserver

type DeprecationObserver func(context.Context, CommandRequest, []Deprecation)

type Desktop

type Desktop struct {
	ID          DesktopID `json:"id"`
	Name        string    `json:"name"`
	Order       int       `json:"order"`
	Tabs        []Tab     `json:"tabs"`
	ActiveTabID TabID     `json:"active_tab_id"`
}

Desktop owns an ordered tab bar.

type DesktopID

type DesktopID string

type DesktopTransition

type DesktopTransition string

DesktopTransition controls the client presentation used when switching desktops.

type DesktopV5

type DesktopV5 struct {
	ID             DesktopID         `json:"id"`
	Name           string            `json:"name"`
	Order          int               `json:"order"`
	Groups         []LayoutGroupV5   `json:"groups"`
	Floating       []WindowID        `json:"floating"`
	FloatingStacks []FloatingStackV5 `json:"floating_stacks"`
}

type Diagnostic

type Diagnostic struct {
	Code    string `json:"code"`
	Path    string `json:"path,omitempty"`
	Message string `json:"message"`
}

Diagnostic identifies one stable validation failure.

type DragAwayPolicy

type DragAwayPolicy string

DragAwayPolicy controls whether dragging detaches one window or its tiled group.

type DropPlacement

type DropPlacement string
const (
	DropTab      DropPlacement = "tab"
	DropFloating DropPlacement = "floating"
	DropBefore   DropPlacement = "before"
	DropAfter    DropPlacement = "after"
	DropLeft     DropPlacement = "left"
	DropRight    DropPlacement = "right"
	DropTop      DropPlacement = "top"
	DropBottom   DropPlacement = "bottom"
	DropCenter   DropPlacement = "center"
)

type Edge

type Edge string

type Event

type Event struct {
	WorkspaceID WorkspaceID `json:"workspace_id"`
	Revision    Revision    `json:"revision"`
	CommandID   CommandID   `json:"command_id"`
	Changes     ChangeSet   `json:"changes"`
	Actor       Actor       `json:"actor"`
	Origin      string      `json:"origin,omitempty"`
	OccurredAt  time.Time   `json:"occurred_at"`
}

Event is published after one durable commit.

type EventObserver

type EventObserver func(context.Context, Event)

EventObserver receives an isolated copy of one observable committed event.

type ExtensionDefaultShortcut

type ExtensionDefaultShortcut struct {
	CommandID string
	Chord     string
	Source    string
	Active    bool
}

ExtensionDefaultShortcut is one ordered bind-if-free extension claim.

type ExtensionDefaultStatus

type ExtensionDefaultStatus struct {
	CommandID    string
	Binding      ShortcutBinding
	Source       string
	Dormant      bool
	ConflictWith string
}

ExtensionDefaultStatus explains whether one extension claim is effective.

type FloatingStackV5

type FloatingStackV5 struct {
	ID        NodeID         `json:"id"`
	WindowIDs []WindowID     `json:"window_ids"`
	ActiveID  *WindowID      `json:"active_id,omitzero"`
	Rect      NormalizedRect `json:"rect"`
	Minimized bool           `json:"minimized"`
}

type FocusDirection

type FocusDirection string
const (
	FocusLeft  FocusDirection = "left"
	FocusRight FocusDirection = "right"
	FocusUp    FocusDirection = "up"
	FocusDown  FocusDirection = "down"
)

type FocusPolicy

type FocusPolicy string

FocusPolicy controls how pointer and directional focus interact.

type FocusWindowCommand

type FocusWindowCommand struct {
	WindowID  *WindowID
	Direction FocusDirection
}

func (FocusWindowCommand) CommandID

func (FocusWindowCommand) CommandID() CommandID

type FrameResizeLayoutCommand

type FrameResizeLayoutCommand struct {
	DesktopID DesktopID
	Edits     []GroupFrameEdit
}

FrameResizeLayoutCommand is a deprecated no-op accepted through v0.7.

func (FrameResizeLayoutCommand) CommandID

func (FrameResizeLayoutCommand) CommandID() CommandID

type GapsConfig

type GapsConfig struct {
	Inner  float64 `json:"inner"`
	Top    float64 `json:"top"`
	Right  float64 `json:"right"`
	Bottom float64 `json:"bottom"`
	Left   float64 `json:"left"`
}

GapsConfig defines the inner and outer layout gaps in CSS pixels.

type GlobalShortcutFailureObserver

type GlobalShortcutFailureObserver func(
	context.Context,
	WorkspaceID,
	ClientID,
	GlobalShortcutRegistration,
)

GlobalShortcutFailureObserver receives one changed shell registration failure.

type GlobalShortcutRegistration

type GlobalShortcutRegistration struct {
	CommandID     string               `json:"command_id"`
	IntendedChord string               `json:"intended_chord"`
	ActiveChord   string               `json:"active_chord,omitempty"`
	Status        GlobalShortcutStatus `json:"status"`
	Reason        string               `json:"reason,omitempty"`
	SettingsURL   string               `json:"settings_url,omitempty"`
}

GlobalShortcutRegistration is ephemeral shell-owned state for one command.

func CloneGlobalShortcutRegistrations

func CloneGlobalShortcutRegistrations(
	source []GlobalShortcutRegistration,
) []GlobalShortcutRegistration

CloneGlobalShortcutRegistrations returns an ownership-safe status slice.

type GlobalShortcutStatus

type GlobalShortcutStatus string

GlobalShortcutStatus reports the desktop shell's registration result for one intended chord.

const (
	GlobalShortcutRegistered       GlobalShortcutStatus = "registered"
	GlobalShortcutFailedInUse      GlobalShortcutStatus = "failed_in_use"
	GlobalShortcutFailedPermission GlobalShortcutStatus = "failed_permission"
	GlobalShortcutUnsupported      GlobalShortcutStatus = "unsupported"
)

type GroupFrameEdit

type GroupFrameEdit struct {
	GroupID GroupID
	Frame   NormalizedRect
}

GroupFrameEdit assigns one group frame inside an atomic multi-group resize.

type GroupID

type GroupID string

type GroupWindowsCommand

type GroupWindowsCommand struct {
	TargetWindowID WindowID   `json:"target_window_id"`
	WindowIDs      []WindowID `json:"window_ids"`
	InsertIndex    *int       `json:"insert_index,omitzero"`
}

func (GroupWindowsCommand) CommandID

func (GroupWindowsCommand) CommandID() CommandID

type History

type History struct {
	Undo []HistoryEntry `json:"undo"`
	Redo []HistoryEntry `json:"redo"`
}

History contains bounded undo and redo stacks.

type HistoryEntry

type HistoryEntry struct {
	CommandID CommandID
	Before    State
	After     State
	Actor     Actor
	Origin    string
	CreatedAt time.Time
}

HistoryEntry stores an exact operation boundary.

type LayoutAspectVariant

type LayoutAspectVariant string
const (
	LayoutAspectAny       LayoutAspectVariant = "any"
	LayoutAspectLandscape LayoutAspectVariant = "landscape"
	LayoutAspectPortrait  LayoutAspectVariant = "portrait"
)

type LayoutDocument

type LayoutDocument struct {
	// InputDeprecations is transient request metadata, excluded from exported layouts and stored state.
	InputDeprecations []Deprecation       `json:"-"`
	Version           uint32              `json:"version"`
	WorkspaceID       WorkspaceID         `json:"workspace_id"`
	Desktops          []Desktop           `json:"desktops"`
	Windows           map[WindowID]Window `json:"windows"`
	Overrides         WorkspaceConfig     `json:"overrides"`
}

LayoutDocument is the validated raw export and replacement contract.

func (*LayoutDocument) UnmarshalJSON

func (document *LayoutDocument) UnmarshalJSON(raw []byte) error

UnmarshalJSON permanently accepts saved v4/v5 layouts at the document boundary.

type LayoutDocumentV5

type LayoutDocumentV5 struct {
	Version     uint32                `json:"version"`
	WorkspaceID WorkspaceID           `json:"workspace_id"`
	Desktops    []DesktopV5           `json:"desktops"`
	Windows     map[WindowID]WindowV5 `json:"windows"`
	Overrides   WorkspaceConfigV5     `json:"overrides"`
}

type LayoutGroupV5

type LayoutGroupV5 struct {
	ID    GroupID        `json:"id"`
	Frame NormalizedRect `json:"frame"`
	Root  LayoutNodeV5   `json:"root"`
}

type LayoutNode

type LayoutNode struct {
	ID       NodeID       `json:"id"`
	Kind     NodeKind     `json:"kind"`
	WindowID *WindowID    `json:"window_id,omitzero"`
	Axis     *Axis        `json:"axis,omitzero"`
	Children []LayoutNode `json:"children,omitempty"`
	Weights  []float64    `json:"weights,omitempty"`
}

type LayoutNodeV5

type LayoutNodeV5 struct {
	ID        NodeID         `json:"id"`
	Kind      NodeKind       `json:"kind"`
	WindowID  *WindowID      `json:"window_id,omitzero"`
	Axis      *Axis          `json:"axis,omitzero"`
	Children  []LayoutNodeV5 `json:"children,omitempty"`
	Weights   []float64      `json:"weights,omitempty"`
	WindowIDs []WindowID     `json:"window_ids,omitempty"`
	ActiveID  *WindowID      `json:"active_id,omitzero"`
}

type LayoutOverflowPolicy

type LayoutOverflowPolicy string
const (
	LayoutOverflowStack  LayoutOverflowPolicy = "stack"
	LayoutOverflowReject LayoutOverflowPolicy = "reject"
)

type LayoutResource

type LayoutResource struct {
	Version          uint32               `json:"version"`
	ID               string               `json:"id"`
	DisplayName      string               `json:"display_name"`
	AspectVariant    LayoutAspectVariant  `json:"aspect_variant"`
	ParticipantSlots []WindowID           `json:"participant_slots,omitempty"`
	OverflowPolicy   LayoutOverflowPolicy `json:"overflow_policy"`
	Document         LayoutDocument       `json:"document"`
}

LayoutResource describes one declarative registry contribution.

func CloneLayoutResource

func CloneLayoutResource(resource LayoutResource) LayoutResource

CloneLayoutResource returns a deep copy safe for cross-package catalogs.

type LayoutResourceRegistry

type LayoutResourceRegistry interface {
	Resolve(ctx context.Context, workspaceID WorkspaceID, resourceID string) (LayoutDocument, error)
	List(ctx context.Context, workspaceID WorkspaceID) ([]LayoutResource, error)
}

LayoutResourceRegistry resolves validated declarative layout resources.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager coordinates semantic commands, transient clients, and subscriptions.

func NewService

func NewService(
	repository Repository,
	workspaces WorkspaceResolver,
	layouts LayoutResourceRegistry,
	defaults Config,
	options ...Option,
) (*Manager, error)

NewService constructs the daemon-authoritative window manager.

func (*Manager) AcknowledgeMigration

func (m *Manager) AcknowledgeMigration(
	ctx context.Context, workspace WorkspaceID, at time.Time,
) (MigrationStatus, error)

AcknowledgeMigration acknowledges only the successful conversion observed by the bell.

func (*Manager) AttachClientCommands

func (m *Manager) AttachClientCommands(
	ctx context.Context,
	workspaceID WorkspaceID,
	clientID ClientID,
) (ClientCommandConnection, error)

AttachClientCommands binds one active command channel to an already registered client.

func (*Manager) AuthorizeClient

func (m *Manager) AuthorizeClient(
	ctx context.Context,
	workspaceID WorkspaceID,
	clientID ClientID,
	token string,
) error

AuthorizeClient validates one self-originated attachment token against its registered client.

func (*Manager) Clients

func (m *Manager) Clients(ctx context.Context, workspaceID WorkspaceID) ([]ClientView, error)

Clients lists connected views without leaking another workspace partition.

func (*Manager) Close

func (m *Manager) Close() error

Close terminates live subscriptions and rejects later operations.

func (*Manager) CommandClients

func (m *Manager) CommandClients(ctx context.Context, workspaceID WorkspaceID) ([]ClientView, error)

CommandClients lists registered views with an active command channel in this workspace.

func (*Manager) DeleteWorkspace

func (m *Manager) DeleteWorkspace(ctx context.Context, workspaceID WorkspaceID) error

DeleteWorkspace removes window state, clients, and subscriptions for an authorized workspace.

func (*Manager) DispatchClientCommand

func (m *Manager) DispatchClientCommand(
	ctx context.Context,
	workspaceID WorkspaceID,
	clientID ClientID,
	command ClientCommand,
) (ClientCommandResponse, error)

DispatchClientCommand sends one correlated command and waits for its terminal response.

func (*Manager) Execute

func (m *Manager) Execute(ctx context.Context, request CommandRequest) (Result, error)

Execute applies one semantic command through one compare-and-swap commit.

func (*Manager) ExportLayout

func (m *Manager) ExportLayout(ctx context.Context, workspaceID WorkspaceID) (LayoutDocument, error)

ExportLayout returns a history-free declarative document.

func (*Manager) ForgetWorkspace

func (m *Manager) ForgetWorkspace(workspaceID WorkspaceID)

ForgetWorkspace tears down transient state after the workspace owner commits deletion.

func (*Manager) LayoutResources

func (m *Manager) LayoutResources(ctx context.Context, workspaceID WorkspaceID) ([]LayoutResource, error)

LayoutResources lists declarative resources visible to a workspace.

func (*Manager) Migration

func (m *Manager) Migration(
	ctx context.Context,
	workspace WorkspaceID,
	action string,
	replace bool,
) (MigrationStatus, error)

Migration reads or acknowledges the upgrade notice, or retries a preserved layout.

func (*Manager) Preview

func (m *Manager) Preview(ctx context.Context, request CommandRequest) (Preview, error)

Preview reduces and validates without persisting, publishing, or advancing history.

func (*Manager) ReconcileDeletedSession

func (m *Manager) ReconcileDeletedSession(
	ctx context.Context,
	workspaceID WorkspaceID,
	sessionID string,
) error

ReconcileDeletedSession removes windows for a deleted session, repairs client views and publishes the workspace event without retaining reopenable entries.

func (*Manager) ReconcileUnregisteredWorkspace

func (m *Manager) ReconcileUnregisteredWorkspace(
	ctx context.Context,
	workspaceID WorkspaceID,
	binding string,
) error

ReconcileUnregisteredWorkspace retires bindings and publishes the partition event.

func (*Manager) RegisterClient

func (m *Manager) RegisterClient(ctx context.Context, registration ClientRegistration) (ClientView, error)

RegisterClient creates or refreshes one explicit client-local view.

func (*Manager) ReplaceLayout

func (m *Manager) ReplaceLayout(ctx context.Context, request ReplaceLayoutRequest) (Result, error)

ReplaceLayout applies a raw layout through the normal semantic command pipeline.

func (*Manager) RetireTerminals

func (m *Manager) RetireTerminals(ctx context.Context, workspaceID WorkspaceID, ids map[string]bool) error

RetireTerminals removes matching bindings (all when ids is nil) without reversible close entries.

func (*Manager) Snapshot

func (m *Manager) Snapshot(ctx context.Context, workspaceID WorkspaceID) (Snapshot, error)

Snapshot returns a validated workspace aggregate.

func (*Manager) Subscribe

func (m *Manager) Subscribe(ctx context.Context, request SubscriptionRequest) (Subscription, error)

Subscribe returns one atomic topology/client fence followed by ordered updates.

func (*Manager) UnregisterClient

func (m *Manager) UnregisterClient(ctx context.Context, workspaceID WorkspaceID, clientID ClientID) error

UnregisterClient removes transient presentation state only.

func (*Manager) UpdateClientContext

func (m *Manager) UpdateClientContext(
	ctx context.Context,
	update ClientContextUpdate,
) (ClientView, error)

UpdateClientContext replaces client-owned palette context and derives topology-owned fields.

func (*Manager) UpdateDefaults

func (m *Manager) UpdateDefaults(defaults Config) error

UpdateDefaults atomically replaces validated runtime defaults for future commands.

func (*Manager) ValidateLayout

func (m *Manager) ValidateLayout(
	ctx context.Context,
	workspaceID WorkspaceID,
	document LayoutDocument,
) (Validation, error)

ValidateLayout returns diagnostics and the canonical input without reading live windows or writing state.

type MemoryRepository

type MemoryRepository struct {
	// contains filtered or unexported fields
}

MemoryRepository is an atomic repository for composition tests and ephemeral runtimes.

func NewMemoryRepository

func NewMemoryRepository() *MemoryRepository

NewMemoryRepository creates an empty workspace-partitioned repository.

func (*MemoryRepository) Commit

func (r *MemoryRepository) Commit(ctx context.Context, commit *Commit) error

func (*MemoryRepository) Commits

func (r *MemoryRepository) Commits(workspaceID WorkspaceID) []Commit

Commits returns an immutable copy of a workspace's transaction log.

func (*MemoryRepository) DeleteWorkspace

func (r *MemoryRepository) DeleteWorkspace(ctx context.Context, workspaceID WorkspaceID) error

func (*MemoryRepository) Load

func (r *MemoryRepository) Load(ctx context.Context, workspaceID WorkspaceID) (Snapshot, error)

type MemoryWorkspaceResolver

type MemoryWorkspaceResolver struct {
	// contains filtered or unexported fields
}

MemoryWorkspaceResolver provides explicit workspace registration for tests and ephemeral use.

func NewMemoryWorkspaceResolver

func NewMemoryWorkspaceResolver(workspaceIDs ...WorkspaceID) *MemoryWorkspaceResolver

NewMemoryWorkspaceResolver registers the supplied workspaces.

func (*MemoryWorkspaceResolver) Register

func (r *MemoryWorkspaceResolver) Register(workspaceID WorkspaceID)

Register makes a workspace resolvable.

func (*MemoryWorkspaceResolver) ResolveWorkspace

func (r *MemoryWorkspaceResolver) ResolveWorkspace(ctx context.Context, workspaceID WorkspaceID) error

func (*MemoryWorkspaceResolver) Unregister

func (r *MemoryWorkspaceResolver) Unregister(workspaceID WorkspaceID)

Unregister makes a workspace unavailable.

type MigrationAcknowledgementRepository

type MigrationAcknowledgementRepository interface {
	AcknowledgeMigration(context.Context, WorkspaceID, time.Time) (MigrationStatus, error)
}

type MigrationNotice

type MigrationNotice struct {
	WorkspaceID WorkspaceID
	ProfileID   string
	Status      MigrationStatus
}

type MigrationRepository

type MigrationRepository interface {
	Migration(context.Context, WorkspaceID, string, bool) (MigrationStatus, error)
}

MigrationRepository owns the atomic stored-snapshot upgrade and its recovery record.

type MigrationStatus

type MigrationStatus struct {
	State             string            `json:"state"`
	FromVersion       uint32            `json:"from_version,omitempty"`
	At                time.Time         `json:"at,omitzero"`
	Acknowledged      bool              `json:"acknowledged"`
	Summary           *MigrationSummary `json:"summary,omitzero"`
	Error             *Diagnostic       `json:"error,omitzero"`
	FailureRevision   Revision          `json:"failure_revision,omitempty"`
	SupersededBackups int               `json:"superseded_backups,omitempty"`
}

type MigrationSummary

type MigrationSummary struct {
	Desktops           int `json:"desktops"`
	Tabs               int `json:"tabs"`
	Windows            int `json:"windows"`
	FloatingToTabs     int `json:"floating_to_tabs"`
	MinimizedToTabs    int `json:"minimized_to_tabs"`
	IslandsMerged      int `json:"islands_merged"`
	PinsDropped        int `json:"pins_dropped"`
	ZoomDesktopsMerged int `json:"zoom_desktops_merged"`
}

type MoveWindowCommand

type MoveWindowCommand struct {
	WindowID             WindowID
	DestinationDesktopID DesktopID
	TargetWindowID       *WindowID
	TargetTabID          *TabID
	Placement            DropPlacement
	FloatingRect         *NormalizedRect
	MoveGroup            bool
}

func (MoveWindowCommand) CommandID

func (MoveWindowCommand) CommandID() CommandID
type NavigateMode string
const (
	NavigateReplace NavigateMode = ""
	NavigatePush    NavigateMode = "push"
	NavigatePop     NavigateMode = "pop"
)
type NavigateWindowCommand struct {
	WindowID WindowID    `json:"window_id"`
	Route    RouteIntent `json:"route,omitzero"`
	// InstanceKey retargets the window to another app instance in the same
	// navigation; valid only with replace mode and resets the nav stack.
	InstanceKey *string      `json:"instance_key,omitzero"`
	Mode        NavigateMode `json:"mode,omitempty"`
}
func (NavigateWindowCommand) CommandID() CommandID

type NewWindowPolicy

type NewWindowPolicy string

NewWindowPolicy controls how newly opened windows enter a desktop.

type NodeID

type NodeID string

type NodeKind

type NodeKind string
const (
	NodeKindLeaf  NodeKind = "leaf"
	NodeKindSplit NodeKind = "split"
)

type NormalizedRect

type NormalizedRect struct {
	X      float64 `json:"x"`
	Y      float64 `json:"y"`
	Width  float64 `json:"width"`
	Height float64 `json:"height"`
}

NormalizedRect is viewport-independent geometry in the closed unit square.

type OpenWindowCommand

type OpenWindowCommand struct {
	Window          WindowSpec
	RestoreWindowID *WindowID
	// contains filtered or unexported fields
}

func (OpenWindowCommand) CommandID

func (OpenWindowCommand) CommandID() CommandID

type Option

type Option func(*managerOptions) error

Option customizes the manager without introducing operational globals.

func WithAppDeprecationObserver

func WithAppDeprecationObserver(observer AppDeprecationObserver) Option

WithAppDeprecationObserver observes public aliases until removal in v0.5.0.

func WithClientUnregisteredObserver

func WithClientUnregisteredObserver(observer ClientUnregisteredObserver) Option

WithClientUnregisteredObserver observes a client after its local state is removed.

func WithClock

func WithClock(now func() time.Time) Option

WithClock injects deterministic commit and client timestamps.

func WithDeprecationObserver

func WithDeprecationObserver(observer DeprecationObserver) Option

func WithEventObserver

func WithEventObserver(observer EventObserver) Option

WithEventObserver observes lifecycle events after their durable commit succeeds.

func WithGlobalShortcutFailureObserver

func WithGlobalShortcutFailureObserver(observer GlobalShortcutFailureObserver) Option

WithGlobalShortcutFailureObserver observes shell registration failures.

func WithIDGenerator

func WithIDGenerator(generate func(string) (string, error)) Option

WithIDGenerator injects deterministic entity identifiers.

func WithLifecycleContext

func WithLifecycleContext(ctx context.Context) Option

WithLifecycleContext preserves boot-scoped values for detached background work.

func WithRegisteredApps

func WithRegisteredApps(registered func(string) bool) Option

WithRegisteredApps validates new windows against the composition root's app inventory.

func WithSubscriptionBuffer

func WithSubscriptionBuffer(size int) Option

WithSubscriptionBuffer configures bounded subscriber backpressure.

func WithWorkspaceConfigResolver

func WithWorkspaceConfigResolver(resolver WorkspaceConfigResolver) Option

WithWorkspaceConfigResolver resolves workspace-scoped runtime behavior.

type PaletteContext

type PaletteContext struct {
	WindowFocused       bool         `json:"window_focused"`
	WindowFloating      bool         `json:"window_floating"                 deprecated:"true"`
	WindowInSplit       bool         `json:"window_in_split"`
	WindowStacked       bool         `json:"window_stacked"                  deprecated:"true"`
	DesktopWindowCount  int          `json:"desktop_window_count"`
	ScopeGlobal         bool         `json:"scope_global"`
	ShellDesktop        bool         `json:"shell_desktop"`
	FocusedSessionState string       `json:"focused_session_state,omitempty"`
	WorkspaceTrusted    bool         `json:"workspace_trusted"`
	DestinationIntent   *RouteIntent `json:"destination_intent,omitzero"`
}

PaletteContext is the volatile, client-targeted availability snapshot.

type PinWindowCommand

type PinWindowCommand struct {
	WindowID WindowID `json:"window_id"`
	Pinned   bool     `json:"pinned"`
}

func (PinWindowCommand) CommandID

func (PinWindowCommand) CommandID() CommandID

type Preview

type Preview struct {
	Deprecations []Deprecation `json:"deprecations"`
	Snapshot     Snapshot      `json:"snapshot"`
	Changed      bool          `json:"changed"`
	Changes      ChangeSet     `json:"changes"`
	Diagnostics  []Diagnostic  `json:"diagnostics,omitempty"`
	Client       *ClientView   `json:"client,omitzero"`
}

Preview reports a validated proposal without a durable write.

type RebaseGuard

type RebaseGuard struct {
	TabID         *TabID
	WindowID      *WindowID
	SourceNodeID  *NodeID
	TargetNodeID  *NodeID
	SplitID       *NodeID
	BoundaryIndex *int
}

RebaseGuard proves stale source and target identities are still unambiguous.

type RedoLayoutCommand

type RedoLayoutCommand struct{}

func (RedoLayoutCommand) CommandID

func (RedoLayoutCommand) CommandID() CommandID

type ReopenCommand

type ReopenCommand struct{}

func (ReopenCommand) CommandID

func (ReopenCommand) CommandID() CommandID

type ReorderDesktopCommand

type ReorderDesktopCommand struct {
	DesktopID DesktopID
	Order     int
}

func (ReorderDesktopCommand) CommandID

func (ReorderDesktopCommand) CommandID() CommandID

type ReorderStackCommand

type ReorderStackCommand struct {
	WindowID WindowID `json:"window_id"`
	Index    int      `json:"index"`
}

func (ReorderStackCommand) CommandID

func (ReorderStackCommand) CommandID() CommandID

type ReorderTabCommand

type ReorderTabCommand struct {
	WindowID WindowID `json:"window_id"`
	Index    int      `json:"index"`
}

func (ReorderTabCommand) CommandID

func (ReorderTabCommand) CommandID() CommandID

type ReplaceLayoutCommand

type ReplaceLayoutCommand struct{ Document LayoutDocument }

func (ReplaceLayoutCommand) CommandID

func (ReplaceLayoutCommand) CommandID() CommandID

type ReplaceLayoutRequest

type ReplaceLayoutRequest struct {
	WorkspaceID      WorkspaceID
	ExpectedRevision Revision
	ClientID         *ClientID
	Actor            Actor
	Origin           string
	Document         LayoutDocument
}

ReplaceLayoutRequest applies a validated document with normal revision CAS.

type Repository

type Repository interface {
	Load(ctx context.Context, workspaceID WorkspaceID) (Snapshot, error)
	Commit(ctx context.Context, commit *Commit) error
	// DeleteWorkspace is atomic: an error leaves the workspace state unchanged.
	DeleteWorkspace(ctx context.Context, workspaceID WorkspaceID) error
}

Repository stores the complete aggregate atomically.

type ResizeLayoutCommand

type ResizeLayoutCommand struct {
	SplitID       NodeID
	BoundaryIndex int
	Delta         float64
}

func (ResizeLayoutCommand) CommandID

func (ResizeLayoutCommand) CommandID() CommandID

type ResizeWindowCommand

type ResizeWindowCommand struct {
	WindowID WindowID
	Frame    NormalizedRect
}

ResizeWindowCommand is a deprecated no-op accepted through v0.7.

func (ResizeWindowCommand) CommandID

func (ResizeWindowCommand) CommandID() CommandID

type Result

type Result struct {
	Deprecations []Deprecation `json:"deprecations"`
	Snapshot     Snapshot      `json:"snapshot"`
	Applied      bool          `json:"applied"`
	Changes      ChangeSet     `json:"changes"`
	Diagnostics  []Diagnostic  `json:"diagnostics,omitempty"`
	Client       *ClientView   `json:"client,omitzero"`
	RebasedFrom  *Revision     `json:"rebased_from,omitzero"`
}

Result reports one applied or no-op command.

type ReturnAnchorV5

type ReturnAnchorV5 struct {
	DesktopID      DesktopID        `json:"desktop_id"`
	GroupID        *GroupID         `json:"group_id,omitzero"`
	ParentSplitID  *NodeID          `json:"parent_split_id,omitzero"`
	ChildIndex     *int             `json:"child_index,omitzero"`
	Weight         *float64         `json:"weight,omitzero"`
	NeighborIDs    []WindowID       `json:"neighbor_ids,omitempty"`
	SourceRevision Revision         `json:"source_revision"`
	SourceGroup    *LayoutGroupV5   `json:"source_group,omitzero"`
	SourceStack    *FloatingStackV5 `json:"source_stack,omitzero"`
	// Zoomed restores the zoom a minimized window held when it left.
	Zoomed bool `json:"zoomed,omitzero"`
}

type Revision

type Revision uint64

func NextTopologyRevision

func NextTopologyRevision(current Revision) (Revision, error)

NextTopologyRevision returns the next JSON-safe durable topology revision.

type RevisionConflictError

type RevisionConflictError struct {
	Expected Revision
	Current  Revision
	Details  []Conflict
}

RevisionConflictError reports the current revision and failed rebase guards.

func (*RevisionConflictError) Error

func (e *RevisionConflictError) Error() string

func (*RevisionConflictError) Unwrap

func (e *RevisionConflictError) Unwrap() error

type RouteIntent

type RouteIntent struct {
	Pathname string      `json:"pathname"`
	Search   RouteSearch `json:"search"`
}

RouteIntent is one application-internal durable navigation target.

func CanonicalRouteIntent

func CanonicalRouteIntent(route RouteIntent) (RouteIntent, error)

CanonicalRouteIntent validates and normalizes a durable application route.

func RewriteRetiredAppRoute

func RewriteRetiredAppRoute(app string, route RouteIntent) RouteIntent

func (*RouteIntent) UnmarshalJSON

func (route *RouteIntent) UnmarshalJSON(data []byte) error

UnmarshalJSON rejects incomplete, external, or non-object route intents.

type RouteSearch

type RouteSearch map[string]json.RawMessage

RouteSearch is a canonical JSON object containing durable route search state.

type SetStackActiveCommand

type SetStackActiveCommand struct {
	WindowID WindowID `json:"window_id"`
}

func (SetStackActiveCommand) CommandID

func (SetStackActiveCommand) CommandID() CommandID

type ShortcutBinding

type ShortcutBinding []string

ShortcutBinding is one action's ordered shortcut list. An empty binding disables the action.

func (*ShortcutBinding) UnmarshalJSON

func (b *ShortcutBinding) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts the public v2 string-or-array shape.

func (*ShortcutBinding) UnmarshalTOML

func (b *ShortcutBinding) UnmarshalTOML(value any) error

UnmarshalTOML accepts the v2 untagged string-or-array shape.

type ShortcutConflictError

type ShortcutConflictError struct {
	Chord   string
	Owner   string
	Command string
}

ShortcutConflictError identifies both owners of one chord.

func (*ShortcutConflictError) Error

func (e *ShortcutConflictError) Error() string

func (*ShortcutConflictError) Unwrap

func (e *ShortcutConflictError) Unwrap() error

type ShortcutDiagnostic

type ShortcutDiagnostic struct {
	CommandID string `json:"command_id"`
	Message   string `json:"message"`
}

ShortcutDiagnostic reports a stored keymap entry omitted from the effective map.

func TolerantEffectiveKeymap

func TolerantEffectiveKeymap(
	overrides map[string]ShortcutBinding,
	bindableIDs BindableIDs,
) (map[string]ShortcutBinding, []ShortcutDiagnostic, error)

TolerantEffectiveKeymap drops dead stored ids while preserving live overrides.

type SmallViewportPolicy

type SmallViewportPolicy string

SmallViewportPolicy controls layout behavior when the viewport cannot fit a tiled arrangement.

type SnapConfig

type SnapConfig struct {
	EdgeBand     float64   `json:"edge_band"`
	CornerReach  float64   `json:"corner_reach"`
	ExitSlack    float64   `json:"exit_slack"`
	RepeatRatios []float64 `json:"repeat_ratios"`
}

SnapConfig defines pointer thresholds and repeated edge-snap ratios.

type Snapshot

type Snapshot struct {
	Version       uint32              `json:"version"`
	WorkspaceID   WorkspaceID         `json:"workspace_id"`
	Revision      Revision            `json:"revision"`
	Desktops      []Desktop           `json:"desktops"`
	Windows       map[WindowID]Window `json:"windows"`
	ClosedEntries []ClosedEntry       `json:"closed_entries,omitempty"`
	History       History             `json:"history"`
	Overrides     WorkspaceConfig     `json:"overrides"`
	Migration     *MigrationStatus    `json:"migration,omitzero"`
	UpdatedAt     time.Time           `json:"updated_at"`
}

Snapshot is the complete durable workspace aggregate.

func DefaultSnapshot

func DefaultSnapshot(id WorkspaceID) Snapshot

DefaultSnapshot is the stable empty-workspace topology before the first commit: one desktop with no tabs. A New Tab exists only when someone opens one (#1799).

func NormalizeSnapshot

func NormalizeSnapshot(snapshot Snapshot) Snapshot

func ReconcileRegisteredApps

func ReconcileRegisteredApps(snapshot Snapshot, registered func(app string) bool) (Snapshot, bool)

ReconcileRegisteredApps removes retired apps and repairs their durable topology without mutating its input.

func ReconcileTerminalWindows

func ReconcileTerminalWindows(snapshot Snapshot, live func(string) bool) (Snapshot, bool)

ReconcileTerminalWindows removes dead terminal references, including undo and reopen history.

func RetireEmptyDesktopPlaceholders

func RetireEmptyDesktopPlaceholders(snapshot Snapshot) (Snapshot, bool)

RetireEmptyDesktopPlaceholders drops the New Tab windows of every desktop that holds nothing else, in the snapshot and in its undo/redo states, without mutating its input. Releases up to v0.7.4 seeded such a placeholder into every empty desktop; an empty desktop now has no tabs (#1799). A New Tab carries no content, so dropping it is lossless; one beside real tabs stays. The daemon runs it once per stored aggregate, before its first commit on this release. Remove it in v0.9.0.

type SnapshotQuotaError

type SnapshotQuotaError struct{ Cause error }

SnapshotQuotaError leaves the stored layout and backups intact when preservation cannot fit.

func (*SnapshotQuotaError) Diagnostic

func (e *SnapshotQuotaError) Diagnostic() Diagnostic

func (*SnapshotQuotaError) Error

func (e *SnapshotQuotaError) Error() string

func (*SnapshotQuotaError) Unwrap

func (e *SnapshotQuotaError) Unwrap() []error

type SnapshotV5

type SnapshotV5 struct {
	Version       uint32                `json:"version"`
	WorkspaceID   WorkspaceID           `json:"workspace_id"`
	Revision      Revision              `json:"revision"`
	Desktops      []DesktopV5           `json:"desktops"`
	Windows       map[WindowID]WindowV5 `json:"windows"`
	ClosedEntries []ClosedEntryV5       `json:"closed_entries,omitempty"`
	History       json.RawMessage       `json:"history"`
	Overrides     WorkspaceConfigV5     `json:"overrides"`
	UpdatedAt     time.Time             `json:"updated_at"`
}

func MigrateLegacySnapshotV3

func MigrateLegacySnapshotV3(encoded []byte) (SnapshotV5, error)

MigrateLegacySnapshotV3 chains v3 through the v4 geometry and v5 app identities. A focus desktop becomes a regular desktop whose owner is zoomed on it with its return anchor intact, exactly like a unit that zoom lifted there; layout history does not survive because its entries carry the old shape. The result carries the next revision: its content differs from what any client cached under the stored revision.

func MigrateSnapshotV4

func MigrateSnapshotV4(encoded []byte) (SnapshotV5, error)

type SnapshotVersionError

type SnapshotVersionError struct {
	Version uint32
}

SnapshotVersionError refuses newer user state without changing its bytes.

func (*SnapshotVersionError) Diagnostic

func (e *SnapshotVersionError) Diagnostic() Diagnostic

func (*SnapshotVersionError) Error

func (e *SnapshotVersionError) Error() string

func (*SnapshotVersionError) Unwrap

func (e *SnapshotVersionError) Unwrap() error

type State

type State struct {
	Desktops      []Desktop
	Windows       map[WindowID]Window
	Overrides     WorkspaceConfig
	ClosedEntries []ClosedEntry
}

State is the revision-independent content restored by history.

type Subscription

type Subscription interface {
	Fence() SubscriptionFence
	Updates() <-chan SubscriptionUpdate
	Err() error
	Close() error
}

Subscription fences current state and later ordered updates.

type SubscriptionFence

type SubscriptionFence struct {
	Snapshot Snapshot
	Client   *ClientView
}

SubscriptionFence atomically captures durable topology and optional presentation state.

type SubscriptionRequest

type SubscriptionRequest struct {
	WorkspaceID   WorkspaceID
	AfterRevision Revision
	ClientID      *ClientID
}

SubscriptionRequest binds an optional client view to one stream.

type SubscriptionUpdate

type SubscriptionUpdate struct {
	Snapshot *Snapshot
	Event    *Event
	Client   *ClientView
}

SubscriptionUpdate carries one ordered snapshot, topology, or client presentation change.

type SwapWindowsCommand

type SwapWindowsCommand struct {
	FirstWindowID  WindowID
	SecondWindowID WindowID
}

func (SwapWindowsCommand) CommandID

func (SwapWindowsCommand) CommandID() CommandID

type SwitchDesktopCommand

type SwitchDesktopCommand struct{ DesktopID DesktopID }

func (SwitchDesktopCommand) CommandID

func (SwitchDesktopCommand) CommandID() CommandID

type Tab

type Tab struct {
	ID     TabID      `json:"id"`
	Pinned bool       `json:"pinned"`
	Root   LayoutNode `json:"root"`
}

type TabID

type TabID string

type ToggleFloatingCommand

type ToggleFloatingCommand struct {
	WindowID     WindowID
	FloatingRect *NormalizedRect
}

func (ToggleFloatingCommand) CommandID

func (ToggleFloatingCommand) CommandID() CommandID

type TopologyError

type TopologyError struct {
	Diagnostics []Diagnostic
}

TopologyError reports all independently detectable topology violations.

func (*TopologyError) Error

func (e *TopologyError) Error() string

func (*TopologyError) Unwrap

func (e *TopologyError) Unwrap() error

type UndoLayoutCommand

type UndoLayoutCommand struct{}

func (UndoLayoutCommand) CommandID

func (UndoLayoutCommand) CommandID() CommandID

type UnknownShortcutIDError

type UnknownShortcutIDError struct {
	CommandID string
}

UnknownShortcutIDError reports an attempted binding outside the catalog.

func (*UnknownShortcutIDError) Error

func (e *UnknownShortcutIDError) Error() string

func (*UnknownShortcutIDError) Unwrap

func (e *UnknownShortcutIDError) Unwrap() error

type UpdateDesktopCommand

type UpdateDesktopCommand struct {
	DesktopID DesktopID
	Name      string
}

func (UpdateDesktopCommand) CommandID

func (UpdateDesktopCommand) CommandID() CommandID

type Validation

type Validation struct {
	Valid       bool            `json:"valid"`
	Diagnostics []Diagnostic    `json:"diagnostics,omitempty"`
	Document    *LayoutDocument `json:"document,omitzero"`
}

Validation reports stable diagnostics and the canonical document when valid.

type Window

type Window struct {
	ID          WindowID      `json:"id"`
	App         string        `json:"app"`
	InstanceKey *string       `json:"instance_key,omitzero"`
	Route       RouteIntent   `json:"route"`
	NavStack    []RouteIntent `json:"nav_stack"`
	DesktopID   DesktopID     `json:"desktop_id"`
	TabID       TabID         `json:"tab_id"`
}

type WindowID

type WindowID string

type WindowPlacement

type WindowPlacement string

WindowPlacement is retained only for permanent v3/v4/v5 migration.

const (
	WindowPlacementTiled    WindowPlacement = "tiled"
	WindowPlacementStacked  WindowPlacement = "stacked"
	WindowPlacementFloating WindowPlacement = "floating"
)

type WindowSpec

type WindowSpec struct {
	ID           WindowID       `json:"id,omitempty"`
	App          string         `json:"app"`
	InstanceKey  *string        `json:"instance_key,omitzero"`
	Route        RouteIntent    `json:"route"`
	DesktopID    DesktopID      `json:"desktop_id"`
	FloatingRect NormalizedRect `json:"floating_rect"`
	InsertTiled  bool           `json:"insert_tiled,omitzero"`
	// InsertEdge places a tiled open on this side of its anchor (default right).
	// It requires InsertTiled and excludes a stack target.
	InsertEdge DropPlacement `json:"insert_edge,omitzero"`
	// Floating is retained through v0.7 and opens a tab at the compatibility boundary.
	Floating            bool      `json:"floating,omitzero"`
	StackTargetWindowID *WindowID `json:"stack_target_window_id,omitzero"`
	// BesideWindowID anchors a tiled open (beside_focus, tab, or InsertTiled)
	// to this window instead of the client's focus. Daemon-originated opens
	// have no client focus; they name the window the new one belongs next to.
	BesideWindowID *WindowID `json:"beside_window_id,omitzero"`
}

type WindowV5

type WindowV5 struct {
	ID           WindowID        `json:"id"`
	App          string          `json:"app"`
	InstanceKey  *string         `json:"instance_key,omitzero"`
	Route        RouteIntent     `json:"route"`
	NavStack     []RouteIntent   `json:"nav_stack"`
	Pinned       bool            `json:"pinned"`
	Placement    WindowPlacement `json:"placement"`
	DesktopID    DesktopID       `json:"desktop_id"`
	FloatingRect NormalizedRect  `json:"floating_rect"`
	Minimized    bool            `json:"minimized"`
	// Zoomed fills the desktop work area with the unit holding this window.
	Zoomed       bool            `json:"zoomed"`
	ReturnAnchor *ReturnAnchorV5 `json:"return_anchor,omitzero"`
}

type WorkspaceConfig

type WorkspaceConfig struct {
	NewWindowPolicy     *NewWindowPolicy           `json:"new_window_policy,omitzero"`
	SmallViewportPolicy *SmallViewportPolicy       `json:"small_viewport_policy,omitzero"`
	FocusPolicy         *FocusPolicy               `json:"focus_policy,omitzero"`
	FocusWrap           *bool                      `json:"focus_wrap,omitzero"`
	FocusFollowsPointer *bool                      `json:"focus_follows_pointer,omitzero"`
	RaiseOnFocus        *bool                      `json:"raise_on_focus,omitzero"`
	DragAwayPolicy      *DragAwayPolicy            `json:"drag_away_policy,omitzero"`
	GroupMoveModifier   *string                    `json:"group_move_modifier,omitzero"`
	SwapModifier        *string                    `json:"swap_modifier,omitzero"`
	HistoryLimit        *int                       `json:"history_limit,omitzero"`
	NavStackLimit       *int                       `json:"nav_stack_limit,omitzero"`
	ClosedEntryLimit    *int                       `json:"closed_entry_limit,omitzero"`
	DesktopTransition   *DesktopTransition         `json:"desktop_transition,omitzero"`
	Gaps                *GapsConfig                `json:"gaps,omitzero"`
	Snap                *SnapConfig                `json:"snap,omitzero"`
	Bindings            *BindingsConfig            `json:"bindings,omitzero"`
	Shortcuts           map[string]ShortcutBinding `json:"shortcuts,omitempty"`
}

WorkspaceConfig contains optional workspace overrides.

type WorkspaceConfigResolver

type WorkspaceConfigResolver interface {
	ResolveWindowManagerConfig(context.Context, WorkspaceID, Config) (Config, error)
}

WorkspaceConfigResolver overlays workspace-scoped behavior onto active defaults.

type WorkspaceConfigV5

type WorkspaceConfigV5 struct {
	NewWindowPolicy     *NewWindowPolicy           `json:"new_window_policy,omitzero"`
	SmallViewportPolicy *SmallViewportPolicy       `json:"small_viewport_policy,omitzero"`
	FocusPolicy         *FocusPolicy               `json:"focus_policy,omitzero"`
	FocusWrap           *bool                      `json:"focus_wrap,omitzero"`
	FocusFollowsPointer *bool                      `json:"focus_follows_pointer,omitzero"`
	RaiseOnFocus        *bool                      `json:"raise_on_focus,omitzero"`
	DragAwayPolicy      *DragAwayPolicy            `json:"drag_away_policy,omitzero"`
	GroupMoveModifier   *string                    `json:"group_move_modifier,omitzero"`
	SwapModifier        *string                    `json:"swap_modifier,omitzero"`
	HistoryLimit        *int                       `json:"history_limit,omitzero"`
	NavStackLimit       *int                       `json:"nav_stack_limit,omitzero"`
	ClosedEntryLimit    *int                       `json:"closed_entry_limit,omitzero"`
	DesktopTransition   *DesktopTransition         `json:"desktop_transition,omitzero"`
	Gaps                *GapsConfig                `json:"gaps,omitzero"`
	Snap                *SnapConfig                `json:"snap,omitzero"`
	Bindings            *BindingsConfig            `json:"bindings,omitzero"`
	Shortcuts           map[string]ShortcutBinding `json:"shortcuts,omitempty"`
}

type WorkspaceID

type WorkspaceID string
const GlobalDesktopWorkspaceID WorkspaceID = "global"

GlobalDesktopWorkspaceID is the reserved profile-owned desktop partition used when the operator has no project workspace. It never grants workspace data scope.

const UserDesktopWorkspaceID WorkspaceID = "user"

UserDesktopWorkspaceID is the reserved User desktop partition within one profile.

type WorkspaceResolver

type WorkspaceResolver interface {
	ResolveWorkspace(ctx context.Context, workspaceID WorkspaceID) error
}

WorkspaceResolver authorizes and resolves a workspace before state access.

type ZoomWindowCommand

type ZoomWindowCommand struct{ WindowID WindowID }

func (ZoomWindowCommand) CommandID

func (ZoomWindowCommand) CommandID() CommandID

Source Files

Directories

Path Synopsis
Package statekeys owns profile partitions in the window-manager state domain.
Package statekeys owns profile partitions in the window-manager state domain.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL