magnify

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: 5 Imported by: 0

Documentation

Overview

Package magnify resolves semantic zoom and pinch requests into concrete backend actions.

Index

Constants

View Source
const ShortcutNote = "used the standard app zoom shortcut; public macOS APIs do not expose a generic cross-process magnify gesture injector"

ShortcutNote explains the current fallback used for semantic magnify.

Variables

View Source
var ErrNativeUnsupported = errors.New("native magnify injection is not supported")

ErrNativeUnsupported reports that native magnify injection is not available.

Functions

This section is empty.

Types

type Action

type Action string

Action is a canonical semantic zoom or pinch direction.

const (
	ActionIn    Action = "in"
	ActionOut   Action = "out"
	ActionReset Action = "reset"
)

func ParsePinchDirection

func ParsePinchDirection(value string) (Action, error)

ParsePinchDirection canonicalizes semantic pinch directions.

func ParseZoomAction

func ParseZoomAction(value string) (Action, error)

ParseZoomAction canonicalizes semantic zoom actions.

func PinchElement

func PinchElement(target *axuiautomation.Element, strategy Strategy, direction string) (Action, string, error)

PinchElement focuses target when provided, then applies a semantic pinch direction.

func ZoomElement

func ZoomElement(target *axuiautomation.Element, strategy Strategy, action string) (Action, string, error)

ZoomElement focuses target when provided, then applies a semantic zoom action.

type Shortcut

type Shortcut struct {
	Keys  string
	Label string
}

Shortcut identifies the standard app zoom shortcut for a semantic action.

func Dispatch

func Dispatch(strategy Strategy, action Action, sendKeys func(string) error) (Shortcut, string, error)

Dispatch applies action using strategy and the provided key sender.

func Send

func Send(strategy Strategy, action Action) (Shortcut, string, error)

Send applies action using the configured strategy.

func ShortcutForAction

func ShortcutForAction(action Action) (Shortcut, error)

ShortcutForAction returns the standard app zoom shortcut for action.

type Strategy

type Strategy string

Strategy selects how a semantic magnify request is executed.

const (
	// StrategyShortcut maps semantic magnify actions to standard app zoom
	// shortcuts.
	StrategyShortcut Strategy = "shortcut"

	// StrategyNative is reserved for future trackpad-style magnify injection.
	StrategyNative Strategy = "native"
)

func ParseStrategy

func ParseStrategy(value string) (Strategy, error)

ParseStrategy parses a magnify backend strategy. The zero value and empty input select the shortcut strategy.

Jump to

Keyboard shortcuts

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