intervention

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package intervention detects recent physical user input.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled     bool
	QuietPeriod time.Duration
}

Config controls the user-intervention monitor.

type Monitor

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

Monitor records that physical input happened recently.

func New

func New(cfg Config) *Monitor

New returns a monitor. It does not install an event tap until Start is called.

func (*Monitor) Blocked

func (m *Monitor) Blocked(now time.Time) (Status, bool)

Blocked reports whether actions should pause for recent physical input.

func (*Monitor) Close

func (m *Monitor) Close()

Close releases the event tap resources.

func (*Monitor) Record

func (m *Monitor) Record(kind string, now time.Time)

Record records a physical input event. It is exported for tests.

func (*Monitor) Start

func (m *Monitor) Start() error

Start installs a listen-only event tap when the monitor is enabled.

func (*Monitor) Status

func (m *Monitor) Status() Status

Status returns the current monitor state.

type Status

type Status struct {
	Enabled     bool
	QuietPeriod time.Duration
	LastInput   time.Time
	LastType    string
}

Status reports the monitor state without exposing input payloads.

Jump to

Keyboard shortcuts

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