focusless

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 1 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 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