daemon

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reconciler

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

Reconciler periodically checks for state drift and corrects it.

func NewReconciler

func NewReconciler(cfg ReconcilerConfig, sync *StateSynchronizer, listWindows WindowLister) *Reconciler

NewReconciler creates a new reconciler with the given configuration. The listWindows function should return current terminal window IDs.

func (*Reconciler) ReconcileNow

func (r *Reconciler) ReconcileNow()

ReconcileNow triggers an immediate reconciliation pass.

func (*Reconciler) Run

func (r *Reconciler) Run(ctx context.Context)

Run starts the reconciliation loop. Blocks until context is cancelled.

type ReconcilerConfig

type ReconcilerConfig struct {
	Interval        time.Duration
	CleanupOrphaned bool
	Logger          *slog.Logger
}

ReconcilerConfig holds configuration for the reconciler.

type StateSynchronizer

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

StateSynchronizer handles cleanup when windows close or state drifts.

func NewStateSynchronizer

func NewStateSynchronizer(logger *slog.Logger) *StateSynchronizer

NewStateSynchronizer creates a new state synchronizer.

func (*StateSynchronizer) CleanupOrphanedSessions

func (s *StateSynchronizer) CleanupOrphanedSessions() error

CleanupOrphanedSessions removes tmux sessions that don't have corresponding windows. Only performs cleanup if there are slots registered - otherwise we have no tracking data and would incorrectly kill all sessions.

func (*StateSynchronizer) HandleWindowClosed

func (s *StateSynchronizer) HandleWindowClosed(windowID uint32)

HandleWindowClosed is called when a tracked window is destroyed. It cleans up the orphaned tmux session and updates the registry.

func (*StateSynchronizer) RenumberSlots

func (s *StateSynchronizer) RenumberSlots(desktop int) error

RenumberSlots renumbers slots on a desktop to close gaps after removal. For example: [0, 2, 3] becomes [0, 1, 2]

type WindowLister

type WindowLister func() ([]uint32, error)

WindowLister is a function that returns current terminal window IDs.

func WindowListerFromBackend

func WindowListerFromBackend(backend platform.Backend) WindowLister

WindowListerFromBackend creates a reconciler WindowLister from a platform backend.

Jump to

Keyboard shortcuts

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