windowstate

package
v0.1.0-rc.15 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package windowstate keeps crash recovery records while a window owns its lease.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write[T any](name string, value *T) error

Write atomically replaces a private state file, flushing before the rename so an interrupted write leaves the last complete snapshot available.

Types

type LaunchInbox

type LaunchInbox[T any] struct {
	// contains filtered or unexported fields
}

LaunchInbox forwards desktop launches to the process that owns the windows. Atomic files retain requests across startup and native event coalescing.

func ForwardLaunch

func ForwardLaunch[T any](dir string, request T, wake func()) (*LaunchInbox[T], error)

ForwardLaunch returns nil after handing the request to a running instance.

func (*LaunchInbox[T]) Close

func (q *LaunchInbox[T]) Close()

func (*LaunchInbox[T]) Drain

func (q *LaunchInbox[T]) Drain(lastWindowClosed bool, receive func(T)) error

Drain releases the lease under the dispatch lock when the last window closes and no launch is waiting. A concurrent launch can then become the next owner.

type Window

type Window[T any] struct {
	Value T

	Restored bool
	// contains filtered or unexported fields
}

func Open

func Open[T any](directory, id string, restore bool) (*Window[T], []string, error)

Open restores all windows on a cold application launch. A live lease means the application is already running; another launch then opens a fresh window. Explicit restore IDs identify additional windows of a cold launch.

func (*Window[T]) Forget

func (w *Window[T]) Forget() error

Forget is called only after the user's close request has been approved.

func (*Window[T]) Release

func (w *Window[T]) Release()

Release leaves the recovery record intact on errors and process shutdown.

func (*Window[T]) Save

func (w *Window[T]) Save(value *T) error

Jump to

Keyboard shortcuts

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