darwin

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package darwin provides macOS API bindings using purego, eliminating the need for cgo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AXIsActive

func AXIsActive() bool

AXIsActive checks if accessibility is enabled for this process

func CGEventSourceCreate

func CGEventSourceCreate(stateID uint32) uintptr

CGEventSourceCreate creates a new CGEventSource

func CGMainDisplayID

func CGMainDisplayID() uint32

CGMainDisplayID returns the main display ID

func CaptureScreen

func CaptureScreen(x, y, w, h int32, displayID int32) ([]byte, int, int)

CaptureScreen captures a region of the screen and returns pixel data (BGRA format)

func CreateNSString

func CreateNSString(s string) uintptr

CreateNSString creates an NSString from a Go string via ObjC runtime

func DragMouse

func DragMouse(x, y int32, button uint16) int

DragMouse drags the mouse to (x, y) with the specified button

func GetActiveWindowPID

func GetActiveWindowPID() uint32

GetActiveWindowPID gets the PID of the frontmost application

func GetActiveWindowTitle

func GetActiveWindowTitle() string

GetActiveWindowTitle gets the title of the active window

func GetMainDisplaySize

func GetMainDisplaySize() (int32, int32)

GetMainDisplaySize returns the main display size

func GetNumDisplays

func GetNumDisplays() int

GetNumDisplays returns the number of displays

func GetPixelColor

func GetPixelColor(x, y int32, displayID int32) uint32

GetPixelColor returns the pixel color at (x, y) as RGB hex value

func GetScreenRect

func GetScreenRect(displayID int32) (int32, int32, int32, int32)

GetScreenRect returns the screen rectangle

func GetWindowTitleByPID

func GetWindowTitleByPID(pid uint32) string

GetWindowTitleByPID gets the window title using Accessibility API

func InitError

func InitError() error

InitError returns any initialization error

func InputUTF

func InputUTF(str string)

InputUTF types a UTF-8 string character by character

func Is64Bit

func Is64Bit() bool

Is64Bit returns whether the system is 64-bit

func KeyCodeForChar

func KeyCodeForChar(char byte) uint32

KeyCodeForChar returns the key code for a character

func Location

func Location() (int32, int32)

Location returns the current mouse position

func MinimizeWindow

func MinimizeWindow(pid uint32, minimize bool)

MinimizeWindow minimizes a window using Accessibility API

func MoveMouse

func MoveMouse(x, y int32) int

MoveMouse moves the mouse to (x, y)

func ScrollMouse

func ScrollMouse(x, y int)

ScrollMouse scrolls the mouse wheel

func ShowAlert

func ShowAlert(title, msg, defaultBtn, cancelBtn string) bool

ShowAlert shows an alert using NSAlert via ObjC runtime

func SysScale

func SysScale(displayID int32) float64

SysScale returns the system scale factor

func ToggleKeyCode

func ToggleKeyCode(keyCode uint32, down bool, flags uint64, pid uintptr) int

ToggleKeyCode sends a key down/up event

func ToggleMouse

func ToggleMouse(down bool, button uint16) int

ToggleMouse toggles a mouse button down or up

func UnicodeType

func UnicodeType(char uint32, pid uintptr, isPid int8)

UnicodeType sends a unicode character using keyboard events

Types

type CGPoint

type CGPoint struct {
	X float64
	Y float64
}

CGPoint represents a point in CoreGraphics

type CGRect

type CGRect struct {
	Origin CGPoint
	Size   CGSize
}

CGRect represents a rectangle in CoreGraphics

type CGSize

type CGSize struct {
	Width  float64
	Height float64
}

CGSize represents a size in CoreGraphics

Jump to

Keyboard shortcuts

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