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

macosapp

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

Documentation

Overview

Package macosapp discovers, launches and waits for macOS applications and windows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Activate

func Activate(ctx context.Context, bundleID string) error

Types

type AppSelector

type AppSelector struct {
	BundleID string `json:"bundle_id,omitempty"`
	Name     string `json:"name,omitempty"`
	PID      int    `json:"pid,omitempty"`
}

type ReadyState

type ReadyState struct {
	Ready      bool       `json:"ready"`
	Name       string     `json:"name,omitempty"`
	BundleID   string     `json:"bundle_id,omitempty"`
	PID        int        `json:"pid,omitempty"`
	Frontmost  bool       `json:"frontmost,omitempty"`
	MainWindow WindowInfo `json:"main_window,omitempty"`
}

func WaitUntilReady

func WaitUntilReady(ctx context.Context, selector AppSelector, opts WaitOptions) (*ReadyState, error)

type RunningApp

type RunningApp struct {
	Name     string `json:"name,omitempty"`
	BundleID string `json:"bundle_id,omitempty"`
	PID      int    `json:"pid,omitempty"`
}

func FindRunningApp

func FindRunningApp(apps []RunningApp, selector AppSelector) *RunningApp

func Launch

func Launch(ctx context.Context, bundlePath, bundleID string, frontmost bool) (*RunningApp, error)

func ListRunningApps

func ListRunningApps(ctx context.Context) ([]RunningApp, error)

func ParseLSAppInfoList

func ParseLSAppInfoList(output string) []RunningApp

func WaitForProcess

func WaitForProcess(ctx context.Context, selector AppSelector) (*RunningApp, error)

type WaitOptions

type WaitOptions struct {
	Timeout            time.Duration
	PollInterval       time.Duration
	RequireWindow      bool
	RequireWindowTitle bool
	RequireContent     bool
}

type WindowInfo

type WindowInfo struct {
	Title      string `json:"title,omitempty"`
	X          int    `json:"x,omitempty"`
	Y          int    `json:"y,omitempty"`
	Width      int    `json:"width,omitempty"`
	Height     int    `json:"height,omitempty"`
	ChildCount int    `json:"child_count,omitempty"`
}

func ChooseReadyWindow

func ChooseReadyWindow(windows []WindowInfo, opts WaitOptions) (WindowInfo, bool)

Jump to

Keyboard shortcuts

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