Help us shape the future of Go! Take the 2026 Go Developer Survey

focusless

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package focusless reports the window server's focus and Space state.

Capture reads which process the window server and NSWorkspace each consider frontmost, and which Space is active. FocusedWindow reports the window accessibility considers focused in a process. IsOffSpace reports whether a window lives on a Space other than the active one, which is when synthetic input aimed at it is delivered to whatever is showing instead.

The mechanisms come from github.com/tmc/apple/x/skylight. All functions report ErrUnavailable when SkyLight cannot be reached, so a caller can degrade instead of failing.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnavailable = errors.New("focusless: SkyLight unavailable")

ErrUnavailable is returned by every function on non-darwin platforms.

Functions

func FocusedWindow

func FocusedWindow(pid int) uint32

FocusedWindow always reports none on non-darwin platforms.

func IsOffSpace

func IsOffSpace(wid uint32) (bool, error)

IsOffSpace always fails on non-darwin platforms.

Types

type Snapshot

type Snapshot struct {
	FrontPID     int    `json:"front_pid"`
	WorkspacePID int    `json:"workspace_pid"`
	ActiveSpace  uint64 `json:"active_space"`
}

Snapshot is the observable focus state at one instant.

func Capture

func Capture() (Snapshot, error)

Capture always fails on non-darwin platforms.

Jump to

Keyboard shortcuts

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