Documentation
¶
Overview ¶
Package robotgo Go native cross-platform system automation.
Please make sure Golang, GCC is installed correctly before installing RobotGo;
See Requirements:
https://github.com/marang/robotgo#requirements
Installation:
With Go module support (Go 1.11+), just import:
import "github.com/marang/robotgo"
Otherwise, to install the robotgo package, run the command:
go get -u github.com/marang/robotgo
+bulid windows,next
Index ¶
- Constants
- Variables
- func ActiveName(name string) error
- func ActivePid(pid int, args ...int) error
- func ActivePidC(pid int, args ...int) error
- func Alert(title, msg string, args ...string) bool
- func AlertE(title, msg string, args ...string) (bool, error)
- func ByteToImg(b []byte) (image.Image, error)
- func Capture(args ...int) (*image.RGBA, error)
- func Capture1(args ...int) (*image.RGBA, error)
- func CaptureBitmapStr(args ...int) (string, error)
- func CaptureImg(args ...int) (image.Image, error)
- func CaptureImgNative(args ...int) (image.Image, error)
- func CaptureImgNativeContext(ctx context.Context, args ...int) (image.Image, error)
- func CaptureScreenCast(ctx context.Context, region ...int) (image.Image, error)
- func CaptureScreenCastDisplay(ctx context.Context, displayID int, region ...int) (image.Image, error)
- func CharCodeAt(s string, n int) rune
- func CheckMouse(btn string) C.MMMouseButton
- func Click(args ...interface{})
- func ClickE(args ...interface{}) error
- func ClickImmediateE(args ...interface{}) error
- func ClickV1(args ...interface{})
- func CloseMainDisplay()
- func CloseMainDisplayE() error
- func CloseRemoteDesktopInput() error
- func CloseScreenCastCapture() error
- func CloseWaylandInput()
- func CloseWindow(args ...int)
- func CloseWindowE(args ...int) error
- func CloseWindowKill(args ...int) error
- func CmdCtrl() string
- func CmdV() error
- func CurrentSpecialTable() map[string]string
- func DecodeImg(path string) (image.Image, string, error)
- func DisplaysNum() int
- func DisplaysNumE() (int, error)
- func Drag(x, y int, args ...string)deprecated
- func DragMouse(x, y int, args ...interface{})deprecated
- func DragSmooth(x, y int, args ...interface{})
- func FindBitmapStr(needleStr string, haystackStr ...string) (int, int, error)
- func FindColorCS(x, y, width, height int, color CHex, tolerance ...float64) (int, int, error)
- func FindIds(name string) ([]int, error)
- func FindName(pid int) (string, error)
- func FindNames() ([]string, error)
- func FindPath(pid int) (string, error)
- func FindcolorCS(x, y, width, height int, color CHex, tolerance ...float64) (int, int, error)
- func FreeBitmap(bitmap CBitmap)
- func FreeBitmapArr(bit ...CBitmap)
- func GetActiveC() C.MData
- func GetBHandle() intdeprecated
- func GetBounds(pid int, args ...int) (int, int, int, int)
- func GetBoundsE(pid int, args ...int) (int, int, int, int, error)
- func GetClient(pid int, args ...int) (int, int, int, int)
- func GetClientE(pid int, args ...int) (int, int, int, int, error)
- func GetDisplayBounds(i int) (x, y, w, h int)
- func GetDisplayBoundsE(i int) (x, y, w, h int, err error)
- func GetHWNDByPid(pid int) int
- func GetHandByPidC(pid int, args ...int) C.MData
- func GetHandle() int
- func GetLocationColor(displayId ...int) (string, error)
- func GetMainId() int
- func GetMousePos() (int, int)deprecated
- func GetPid() int
- func GetPidE() (int, error)
- func GetPixelColor(x, y int, displayId ...int) (string, error)
- func GetPxColor(x, y int, displayId ...int) (C.MMRGBHex, error)
- func GetScaleSize(displayId ...int) (int, int)
- func GetScreenSize() (int, int)
- func GetScreenSizeE() (width, height int, err error)
- func GetText(imgPath string, args ...string) (string, error)
- func GetTextContext(ctx context.Context, imgPath string, args ...string) (string, error)
- func GetTextImg(img image.Image, args ...string) (string, error)
- func GetTextImgContext(ctx context.Context, img image.Image, args ...string) (result string, retErr error)
- func GetTitle(args ...int) string
- func GetTitleE(args ...int) (string, error)
- func GetTitleTargetE(target int, isHandle bool) (string, error)
- func GetVersion() string
- func GetXDisplayName() string
- func GetXid(xu *xgbutil.XUtil, pid int) (xproto.Window, error)
- func GetXidByPid(xu *xgbutil.XUtil, pid int) (xproto.Window, error)
- func GetXidFromPid(xu *xgbutil.XUtil, pid int) (xproto.Window, error)deprecated
- func GoString(char *C.char) string
- func Height(img image.Image) int
- func HexToRgb(hex uint32) *C.uint8_t
- func ImgSize(path string) (int, int, error)
- func InvalidateScreenBoundsCache()
- func Is64Bit() bool
- func IsMain(displayId int) bool
- func IsMaximized() bool
- func IsMaximizedE() (bool, error)
- func IsMinimized() bool
- func IsMinimizedE() (bool, error)
- func IsTopMost() bool
- func IsTopMostE() (bool, error)
- func IsValid() bool
- func KeyDown(key string, args ...interface{}) error
- func KeyPress(key string, args ...interface{}) error
- func KeyTap(key string, args ...interface{}) error
- func KeyToggle(key string, args ...interface{}) error
- func KeyToggleImmediate(key string, args ...interface{}) error
- func KeyUp(key string, args ...interface{}) error
- func KeyboardReady() error
- func Kill(pid int) error
- func Location() (int, int)
- func LocationE() (int, int, error)
- func MaxWindow(pid int, args ...interface{})
- func MaxWindowE(pid int, args ...interface{}) error
- func MicroSleep(tm float64)deprecated
- func MilliSleep(tm int)
- func MinWindow(pid int, args ...interface{})
- func MinWindowE(pid int, args ...interface{}) error
- func MouseClick(args ...interface{})deprecated
- func MouseDown(key ...interface{}) error
- func MouseReady() error
- func MouseUp(key ...interface{}) error
- func Move(x, y int, displayId ...int)
- func MoveArgs(x, y int) (int, int)
- func MoveClick(x, y int, args ...interface{})
- func MoveE(x, y int, displayId ...int) error
- func MoveImmediateE(x, y int, displayId ...int) error
- func MoveMouse(x, y int)deprecated
- func MoveMouseSmooth(x, y int, args ...interface{}) booldeprecated
- func MoveRelative(x, y int)
- func MoveRelativeE(x, y int) error
- func MoveScale(x, y int, displayId ...int) (int, int)
- func MoveSmooth(x, y int, args ...interface{}) bool
- func MoveSmoothRelative(x, y int, args ...interface{})
- func MovesClick(x, y int, args ...interface{})
- func Mul(x int) intdeprecated
- func MultiClick(button string, count int, compatibility ...bool) error
- func OpenImg(path string) ([]byte, error)
- func PadHex(hex C.MMRGBHex) string
- func PadHexs(hex CHex) string
- func Paste(text string) error
- func PasteStr(str string) error
- func PidExists(pid int) (bool, error)
- func Pids() ([]int, error)
- func Read(path string) (image.Image, error)
- func ReadAll() (string, error)
- func ReadAllContext(ctx context.Context, selection ...ClipboardSelection) (string, error)
- func RemoteDesktopInputReady(devices RemoteDesktopDevice) error
- func RemoteDesktopInputRestoreToken() string
- func RemoteDesktopTouchDown(stream, slot uint32, x, y float64) error
- func RemoteDesktopTouchMotion(stream, slot uint32, x, y float64) error
- func RemoteDesktopTouchUp(slot uint32) error
- func ResolveWindowHandleE(target int, args ...int) (int, error)
- func RgbToHex(r, g, b uint8) C.uint32_t
- func Run(path string) ([]byte, error)
- func Save(img image.Image, path string, quality ...int) error
- func SaveCapture(path string, args ...int) error
- func SaveCaptureGo(path string, args ...int) error
- func SaveImg(b []byte, path string) error
- func SaveJpeg(img image.Image, path string, quality ...int) error
- func SavePng(img image.Image, path string) error
- func Scale0() intdeprecated
- func Scale1() intdeprecated
- func ScaleF(displayId ...int) float64
- func ScaleX() intdeprecated
- func Scaled(x int, displayId ...int) int
- func Scaled0(x int, f float64) int
- func Scaled1(x int, f float64) int
- func ScreenCastCaptureReady() error
- func ScreenCastCaptureRestoreToken() string
- func Scroll(x, y int, args ...int)
- func ScrollDir(x int, direction ...interface{})
- func ScrollE(x, y int, args ...int) error
- func ScrollImmediateE(x, y int) error
- func ScrollRelative(x, y int, args ...int)
- func ScrollSmooth(to int, args ...int)
- func SetActive(win Handle)
- func SetActiveC(win C.MData)
- func SetActiveE(win Handle) error
- func SetDelay(d ...int)
- func SetHandle(hwnd int)
- func SetHandlePid(pid int, args ...int)
- func SetRuntimeConfig(config RuntimeConfig) error
- func SetTopMost(state bool)
- func SetTopMostE(state bool) error
- func SetWaylandBackend(b WaylandBackend)
- func SetXDisplayName(name string) error
- func Sleep(tm int)
- func StartRemoteDesktopInput(ctx context.Context, devices RemoteDesktopDevice) error
- func StartRemoteDesktopInputWithOptions(ctx context.Context, options RemoteDesktopInputOptions) error
- func StartScreenCastCapture(ctx context.Context, options ScreenCastCaptureOptions, streamIndex ...int) error
- func StrToImg(data string) (image.Image, error)
- func SysScale(displayId ...int) float64
- func ToByteImg(img image.Image, fm ...string) []byte
- func ToImage(bit CBitmap) image.Image
- func ToInterfaces(fields []string) []interface{}
- func ToMMBitmapRef(bit CBitmap) C.MMBitmapRef
- func ToMMRGBHex(hex CHex) C.MMRGBHex
- func ToRGBA(bit CBitmap) *image.RGBA
- func ToRGBAE(bit CBitmap) (*image.RGBA, error)
- func ToRGBAGo(bmp1 Bitmap) *image.RGBA
- func ToRGBAGoE(bitmap Bitmap) (*image.RGBA, error)
- func ToStrBitmap(bit Bitmap) (string, error)
- func ToStringImg(img image.Image, fm ...string) string
- func ToStrings(fields []interface{}) []string
- func ToUC(text string) []string
- func ToUint8p(dst []uint8) ([]uint8, *uint8)
- func Toggle(key ...interface{}) error
- func Try(fun func(), handler func(interface{}))
- func Type(text string, args ...int)
- func TypeDelay(text string, delay int)
- func TypeStr(str string, args ...int)
- func TypeStrDelay(str string, delay int)
- func TypeStrE(str string, args ...int) error
- func TypeStrImmediateE(str string, args ...int) error
- func TypeStringDelayed(str string, delay int)deprecated
- func U8ToHex(hex *C.uint8_t) C.MMRGBHex
- func U32ToHex(hex C.uint32_t) C.MMRGBHex
- func UnicodeType(str uint32, args ...int)
- func UnicodeTypeE(str uint32, args ...int) error
- func Width(img image.Image) int
- func WriteAll(text string) error
- func WriteAllContext(ctx context.Context, text string, selection ...ClipboardSelection) error
- type Bitmap
- func BitmapFromStr(str string) (Bitmap, error)
- func CaptureGo(args ...int) (Bitmap, error)
- func ImgToBitmap(m image.Image) (bit Bitmap)
- func ImgToBitmapE(m image.Image) (bit Bitmap, err error)
- func NewBitmap(data []byte, width, height, bytewidth int, bitsPixel, bytesPerPixel uint8) (Bitmap, error)
- func RGBAToBitmap(r1 *image.RGBA) (bit Bitmap)
- func RGBAToBitmapE(r1 *image.RGBA) (bit Bitmap, err error)
- func ToBitmap(bit CBitmap) Bitmap
- type CBitmap
- func ByteToCBitmap(by []byte) CBitmap
- func ByteToCBitmapE(by []byte) (CBitmap, error)
- func CaptureScreen(args ...int) (CBitmap, error)
- func ImgToCBitmap(img image.Image) CBitmap
- func ImgToCBitmapE(img image.Image) (CBitmap, error)
- func ToCBitmap(bit Bitmap) CBitmap
- func ToCBitmapE(bit Bitmap) (CBitmap, error)
- type CHex
- type CaptureBackend
- type ClipboardSelection
- type DisplayServer
- type FeatureCapability
- type Handle
- type LinuxCapabilities
- type Map
- type Nps
- type Point
- type Rect
- type RemoteDesktopCursorMode
- type RemoteDesktopDevice
- type RemoteDesktopInputOptions
- type RemoteDesktopInputStatus
- type RemoteDesktopPermissionStatus
- type RemoteDesktopPersistMode
- type RemoteDesktopSource
- type RemoteDesktopStream
- type RuntimeBackendInfo
- type RuntimeCapabilities
- type RuntimeConfig
- type RuntimeDiagnostics
- type RuntimeFeatureDiagnostic
- type RuntimeIdentityDiagnostic
- type RuntimeImplementation
- type RuntimePermissionDiagnostic
- type RuntimePermissionState
- type RuntimeProtocolDiagnostic
- type RuntimeRemediation
- type ScreenCastCaptureCursor
- type ScreenCastCaptureOptions
- type ScreenCastCapturePersist
- type ScreenCastCaptureSource
- type ScreenCastCaptureStream
- type Size
- type WaylandBackend
Constants ¶
const ( // RuntimeImplementationNativeCGO identifies a build with native CGO backends. RuntimeImplementationNativeCGO RuntimeImplementation = "native-cgo" // RuntimeImplementationPureGo identifies a build without CGO. RuntimeImplementationPureGo RuntimeImplementation = "pure-go" // FeatureBackendScreenCast identifies an active portal ScreenCast session // whose frames are delivered through PipeWire. FeatureBackendScreenCast = "portal-screencast+pipewire" // FeatureBackendWaylandScreencopy identifies native Wayland capture through // the compositor screencopy protocol. FeatureBackendWaylandScreencopy = "wayland+screencopy" )
const ( ClipboardSelectionClipboard = clipboard.SelectionClipboard ClipboardSelectionPrimary = clipboard.SelectionPrimary )
const ( // KeyA define key "a" KeyA = "a" KeyB = "b" KeyC = "c" KeyD = "d" KeyE = "e" KeyF = "f" KeyG = "g" KeyH = "h" KeyI = "i" KeyJ = "j" KeyK = "k" KeyL = "l" KeyM = "m" KeyN = "n" KeyO = "o" KeyP = "p" KeyQ = "q" KeyR = "r" KeyS = "s" KeyT = "t" KeyU = "u" KeyV = "v" KeyW = "w" KeyX = "x" KeyY = "y" KeyZ = "z" // CapA = "A" CapB = "B" CapC = "C" CapD = "D" CapE = "E" CapF = "F" CapG = "G" CapH = "H" CapI = "I" CapJ = "J" CapK = "K" CapL = "L" CapM = "M" CapN = "N" CapO = "O" CapP = "P" CapQ = "Q" CapR = "R" CapS = "S" CapT = "T" CapU = "U" CapV = "V" CapW = "W" CapX = "X" CapY = "Y" CapZ = "Z" // Key0 = "0" Key1 = "1" Key2 = "2" Key3 = "3" Key4 = "4" Key5 = "5" Key6 = "6" Key7 = "7" Key8 = "8" Key9 = "9" KeyGrave = "`" KeyQuote = "'" KeyDoubleQuote = "\"" KeyQuoter = KeyDoubleQuote // Backspace backspace key string Backspace = "backspace" Delete = "delete" Enter = "enter" Tab = "tab" Esc = "esc" Escape = "escape" Up = "up" // Up arrow key Down = "down" // Down arrow key Right = "right" // Right arrow key Left = "left" // Left arrow key Home = "home" End = "end" Pageup = "pageup" Pagedown = "pagedown" F1 = "f1" F2 = "f2" F3 = "f3" F4 = "f4" F5 = "f5" F6 = "f6" F7 = "f7" F8 = "f8" F9 = "f9" F10 = "f10" F11 = "f11" F12 = "f12" F13 = "f13" F14 = "f14" F15 = "f15" F16 = "f16" F17 = "f17" F18 = "f18" F19 = "f19" F20 = "f20" F21 = "f21" F22 = "f22" F23 = "f23" F24 = "f24" Cmd = "cmd" // is the "win" key for windows Lcmd = "lcmd" // left command Rcmd = "rcmd" // right command // "command" Alt = "alt" Lalt = "lalt" // left alt Ralt = "ralt" // right alt Ctrl = "ctrl" Lctrl = "lctrl" // left ctrl Rctrl = "rctrl" // right ctrl Control = "control" Shift = "shift" Lshift = "lshift" // left shift Rshift = "rshift" // right shift // "right_shift" Capslock = "capslock" Space = "space" Print = "print" Printscreen = "printscreen" // No Mac support Insert = "insert" Menu = "menu" // Windows only AudioMute = "audio_mute" // Mute the volume AudioVolDown = "audio_vol_down" // Lower the volume AudioVolUp = "audio_vol_up" // Increase the volume AudioPlay = "audio_play" AudioStop = "audio_stop" AudioPause = "audio_pause" AudioPrev = "audio_prev" // Previous Track AudioNext = "audio_next" // Next Track AudioRewind = "audio_rewind" // Linux only AudioForward = "audio_forward" // Linux only AudioRepeat = "audio_repeat" // Linux only AudioRandom = "audio_random" // Linux only Num0 = "num0" // numpad 0 Num1 = "num1" Num2 = "num2" Num3 = "num3" Num4 = "num4" Num5 = "num5" Num6 = "num6" Num7 = "num7" Num8 = "num8" Num9 = "num9" NumLock = "num_lock" ScrollLock = "scroll_lock" PauseBreak = "pause_break" NumDecimal = "num." NumPlus = "num+" NumMinus = "num-" NumMul = "num*" NumDiv = "num/" NumClear = "num_clear" NumEnter = "num_enter" NumEqual = "num_equal" LightsMonUp = "lights_mon_up" // Turn up monitor brightness No Windows support LightsMonDown = "lights_mon_down" // Turn down monitor brightness No Windows support LightsKbdToggle = "lights_kbd_toggle" // Toggle keyboard backlight on/off No Windows support LightsKbdUp = "lights_kbd_up" // Turn up keyboard backlight brightness No Windows support LightsKbdDown = "lights_kbd_down" )
Defining a bunch of constants.
const ( // Mleft mouse left button Mleft = "left" Mright = "right" Center = "center" WheelDown = "wheelDown" WheelUp = "wheelUp" WheelLeft = "wheelLeft" WheelRight = "wheelRight" )
const ( RemoteDesktopSourceMonitor = inputportal.SourceMonitor RemoteDesktopSourceWindow = inputportal.SourceWindow RemoteDesktopSourceVirtual = inputportal.SourceVirtual RemoteDesktopCursorHidden = inputportal.CursorHidden RemoteDesktopCursorEmbedded = inputportal.CursorEmbedded RemoteDesktopCursorMetadata = inputportal.CursorMetadata RemoteDesktopPersistNone = inputportal.PersistNone RemoteDesktopPersistApp = inputportal.PersistApplication RemoteDesktopPersistExplicit = inputportal.PersistExplicit )
const ( ScreenCastSourceMonitor = portalpkg.ScreenCastSourceMonitor ScreenCastSourceWindow = portalpkg.ScreenCastSourceWindow ScreenCastSourceVirtual = portalpkg.ScreenCastSourceVirtual ScreenCastCursorHidden = portalpkg.ScreenCastCursorHidden ScreenCastCursorEmbedded = portalpkg.ScreenCastCursorEmbedded ScreenCastCursorMetadata = portalpkg.ScreenCastCursorMetadata ScreenCastPersistNone = portalpkg.ScreenCastPersistNone ScreenCastPersistApp = portalpkg.ScreenCastPersistApplication ScreenCastPersistExplicit = portalpkg.ScreenCastPersistExplicit )
const RuntimeDiagnosticsSchemaVersion = "2"
RuntimeDiagnosticsSchemaVersion identifies the stable JSON/data contract returned by GetRuntimeDiagnostics.
const Version = "v1.0.3"
Version is the current RobotGo module release.
Variables ¶
var ( ErrWaylandDisplay = errors.New("wayland connect failed") ErrNoScreencopy = errors.New("screencopy manager not available") ErrNoOutputs = errors.New("no outputs") ErrDmabufDevice = errors.New("screencopy dmabuf device unsupported") ErrDmabufModifiers = errors.New("screencopy dmabuf modifiers unsupported") ErrDmabufImport = errors.New("screencopy dmabuf import failed") ErrDmabufMap = errors.New("screencopy dmabuf map failed") ErrWaylandPixelFormat = errors.New("screencopy pixel format unsupported") ErrWaylandFailed = errors.New("wayland capture failed") ErrPortalFailed = errors.New("portal capture failed") ErrNotSupported = errors.New("operation not supported on current platform/backend") ErrPermissionDenied = errors.New("permission denied by desktop security policy") )
var ( // MouseSleep set the mouse default millisecond sleep time // Deprecated: use SetRuntimeConfig for runtime changes in concurrent programs. MouseSleep = 0 // KeySleep set the key default millisecond sleep time // Deprecated: use SetRuntimeConfig for runtime changes in concurrent programs. KeySleep = 10 // DisplayID set the screen display id // Deprecated: use SetRuntimeConfig for runtime changes in concurrent programs. DisplayID = -1 // NotPid used the hwnd not pid in windows // Deprecated: use SetRuntimeConfig for runtime changes in concurrent programs. NotPid bool // Scale option the os screen scale // Deprecated: use SetRuntimeConfig for runtime changes in concurrent programs. Scale bool )
var ErrInputNotApplied = errors.New("robotgo: input backend applied no key or button state")
ErrInputNotApplied reports a failed stateful input transition for which the backend proved that it acquired no key or button state.
var ErrInputOwnership = errors.New("robotgo: input state has no matching RobotGo-owned key or button down")
ErrInputOwnership reports an invalid stateful input transition, such as a duplicate down, an up without a matching RobotGo-owned down, or a portal session replacement between the two transitions.
var ErrInputReleasePending = errors.New("robotgo: input release remains pending")
ErrInputReleasePending reports that RobotGo successfully acquired input state but could not confirm its release. The matching Up operation or an explicit backend close can retry the RobotGo-owned release safely.
var ErrInvalidPID = errors.New("invalid process id")
ErrInvalidPID reports a process identifier that cannot safely identify one process on the current platform.
var Keycode = keycode.Keycode
Keycode robotgo hook key's code map
var MouseMap = keycode.MouseMap
MouseMap robotgo hook mouse's code map
var Special = keycode.Special
Special is the special key map
Functions ¶
func ActivePidC ¶
ActivePidC activates the window by PID via X11.
func Alert ¶
Alert shows a simple alert dialog and preserves the legacy bool-only API. Use AlertE when backend failures must be distinguished from user rejection.
func AlertE ¶
AlertE shows a simple alert dialog and reports backend failures explicitly. On Linux it tries zenity, kdialog, xmessage, then notify-send. The final notify-send fallback is valid only for an OK-only informational alert because it cannot report a button choice without optional, backend-dependent actions.
func Capture1 ¶
Capture1 captures a screen region. It preserves the compatibility name used by upstream's platform adapters; new code should use Capture.
func CaptureBitmapStr ¶
CaptureBitmapStr captures the screen and returns the serialized bitmap.
func CaptureImg ¶
CaptureImg capture the screen and return image.Image, error
func CaptureImgNative ¶
CaptureImgNative captures through the session's native backend without opening or reusing a desktop portal. On Wayland this attempts compositor screencopy only; callers may choose an already-authorized portal fallback explicitly after inspecting the returned error.
func CaptureImgNativeContext ¶
CaptureImgNativeContext captures through the native backend while honoring a context deadline for native Wayland screencopy dispatch. It never opens or reuses a desktop portal.
func CaptureScreenCast ¶
CaptureScreenCast returns the next frame from the active persistent session. With no region it returns the complete selected stream. A region must be supplied as x, y, width, height in logical compositor coordinates.
func CaptureScreenCastDisplay ¶
func CaptureScreenCastDisplay(ctx context.Context, displayID int, region ...int) (image.Image, error)
CaptureScreenCastDisplay returns a region only when the active selected stream is an unambiguous monitor match for displayID. Window, virtual, metadata-incomplete, mismatched, and geometrically ambiguous streams fail closed before any frame is read.
func Click ¶
func Click(args ...interface{})
Click click the mouse button
robotgo.Click(button string, double bool)
Examples:
robotgo.Click() // default is left button
robotgo.Click("right")
robotgo.Click("wheelLeft")
func ClickE ¶
func ClickE(args ...interface{}) error
ClickE clicks a mouse button and reports backend availability errors.
func ClickImmediateE ¶
func ClickImmediateE(args ...interface{}) error
ClickImmediateE clicks without applying the configured post-click delay. It is intended for callers that provide bounded scheduling.
func ClickV1 ¶
func ClickV1(args ...interface{})
ClickV1 clicks a mouse button. It preserves the upstream compatibility name while the established RobotGo Click API remains source-compatible.
func CloseMainDisplay ¶
func CloseMainDisplay()
CloseMainDisplay closes the main display and ignores cleanup errors for compatibility. Prefer CloseMainDisplayE in new code.
func CloseMainDisplayE ¶
func CloseMainDisplayE() error
CloseMainDisplayE releases RobotGo-owned native mouse holds and X11 keys, then closes the native main display. Failed mouse releases remain owned so a later call can retry them.
func CloseRemoteDesktopInput ¶
func CloseRemoteDesktopInput() error
CloseRemoteDesktopInput closes the active portal input session. It is safe to call when no session is active.
func CloseScreenCastCapture ¶
func CloseScreenCastCapture() error
CloseScreenCastCapture stops PipeWire and closes the portal session.
func CloseWaylandInput ¶
func CloseWaylandInput()
CloseWaylandInput releases persistent virtual-pointer and virtual-keyboard protocol objects. A later input call reconnects lazily.
func CloseWindowE ¶
CloseWindowE closes the target window and returns an explicit unsupported error on Wayland sessions.
func CloseWindowKill ¶
CloseWindowKill closes the target window and ensures the owning process terminates. If no arguments are provided, it targets the currently selected window (same as CloseWindow()). If a PID (or handle when NotPid is set) is provided, it targets that window. After issuing a normal close, it waits a short time for graceful shutdown and, if the process is still alive, it will force-kill it.
Usage:
CloseWindowKill() // close current window and kill if needed CloseWindowKill(pid) // close by pid and kill if needed CloseWindowKill(pid, 1) // on Windows, treat first arg as handle
func CurrentSpecialTable ¶
CurrentSpecialTable returns the special key map for the active display server. DetectDisplayServer determines whether the Wayland or X11 table should be returned.
func DisplaysNumE ¶
DisplaysNumE returns the active display count and reports an unavailable display-enumeration backend explicitly.
func DragSmooth ¶
func DragSmooth(x, y int, args ...interface{})
DragSmooth drag the mouse like smooth to (x, y)
Examples:
robotgo.DragSmooth(10, 10)
func FindBitmapStr ¶
FindBitmapStr searches for needleStr inside haystackStr.
func FindColorCS ¶
FindColorCS searches a captured region for a color and returns absolute screen coordinates. Tolerance is optional, defaults to 0.01, and must be a finite value in the inclusive range 0 through 1.
func FindIds ¶
FindIds finds the all processes named with a subset of "name" (case insensitive), return matched IDs.
func FindcolorCS ¶
FindcolorCS preserves the historical RobotGo-Pro spelling.
func FreeBitmapArr ¶
func FreeBitmapArr(bit ...CBitmap)
FreeBitmapArr free and dealloc the C bitmap array
func GetBHandle
deprecated
func GetBoundsE ¶
GetBoundsE returns the target window bounds or an explicit backend error.
func GetClientE ¶
GetClientE returns the target window client bounds or an explicit backend error.
func GetDisplayBounds ¶
GetDisplayBounds gets the display screen bounds. Use GetDisplayBoundsE when backend failures must be distinguished from an empty legacy result.
func GetDisplayBoundsE ¶
GetDisplayBoundsE gets the display screen bounds and reports invalid display indices, unavailable backends, and empty backend results explicitly.
func GetHandByPidC ¶
GetHandByPidC get handle mdata by pid
func GetLocationColor ¶
GetLocationColor gets the color of the current mouse location.
func GetMousePos
deprecated
func GetPixelColor ¶
GetPixelColor returns the pixel color as a hex string.
func GetPxColor ¶
GetPxColor returns the pixel color at (x,y). On Linux it captures a 1x1 region through the selected capture backend so invalid coordinates and backend failures are returned as errors instead of looking like black.
func GetScaleSize ¶
GetScaleSize get the screen scale size
func GetScreenSizeE ¶
GetScreenSizeE returns the selected screen size and reports unavailable or empty backend results explicitly.
func GetText ¶
GetText extracts image text by invoking the Tesseract CLI.
robotgo.GetText(imgPath, lang string)
func GetTextContext ¶
GetTextContext extracts image text through the Tesseract CLI with caller-controlled cancellation.
func GetTextImg ¶
GetTextImg get text from image.Image by writing a temporary PNG and running OCR.
func GetTextImgContext ¶
func GetTextImgContext(ctx context.Context, img image.Image, args ...string) (result string, retErr error)
GetTextImgContext writes an image to a private temporary file and runs OCR with caller-controlled cancellation.
func GetTitle ¶
GetTitle get the window title return string
Examples:
fmt.Println(robotgo.GetTitle()) ids, _ := robotgo.FindIds() robotgo.GetTitle(ids[0])
func GetTitleE ¶
GetTitleE gets the window title and returns an explicit unsupported error on Wayland sessions.
func GetTitleTargetE ¶
GetTitleTargetE gets the title of an explicit process or window handle. Unlike GetTitleE, isHandle does not inherit the legacy TreatAsHandle setting.
func GetXidByPid ¶
GetXidByPid returns the XID for the given PID.
func InvalidateScreenBoundsCache ¶
func InvalidateScreenBoundsCache()
InvalidateScreenBoundsCache forces the next Wayland fallback bounds query to re-read compositor output geometry.
func IsMaximized ¶
func IsMaximized() bool
IsMaximized reports whether the current active window is maximized.
func IsMaximizedE ¶
IsMaximizedE reports whether the current active window is maximized. Hyprland uses its compositor state; Linux backends without a trustworthy query return an explicit unsupported error.
func IsMinimized ¶
func IsMinimized() bool
IsMinimized reports whether the current active window is minimized.
func IsMinimizedE ¶
IsMinimizedE reports whether the current active window is minimized and returns an explicit unsupported error on Linux backends without reliable state query support.
func IsTopMost ¶
func IsTopMost() bool
IsTopMost reports whether the current active window is topmost.
func IsTopMostE ¶
IsTopMostE reports whether the current active window is topmost and returns an explicit unsupported error on Linux backends without reliable state query support.
func KeyPress ¶
KeyPress presses and releases a key as one backend transaction. It is equivalent to KeyTap.
func KeyTap ¶
KeyTap taps the keyboard code;
See keys supported:
https://github.com/marang/robotgo/blob/master/docs/keys.md#keys
Examples:
robotgo.KeySleep = 100 // 100 millisecond
robotgo.KeyTap("a")
robotgo.KeyTap("i", "alt", "command")
arr := []string{"alt", "command"}
robotgo.KeyTap("i", arr)
robotgo.KeyTap("k", pid int)
func KeyToggle ¶
KeyToggle toggles the keyboard, if there not have args default is "down"
See keys:
https://github.com/marang/robotgo/blob/master/docs/keys.md#keys
Examples:
robotgo.KeyToggle("a")
robotgo.KeyToggle("a", "up")
robotgo.KeyToggle("a", "up", "alt", "cmd")
robotgo.KeyToggle("k", pid int)
func KeyToggleImmediate ¶
KeyToggleImmediate changes key state without applying the configured post-event delay. It is intended for callers that own a bounded hold.
func KeyboardReady ¶
func KeyboardReady() error
KeyboardReady reports whether the active display backend can inject keyboard input. On Wayland it performs a real virtual-keyboard probe.
func LocationE ¶
LocationE returns the current pointer position. Native Wayland does not expose a trustworthy global pointer location, so it returns ErrNotSupported instead of presenting the last injected position as an observation.
func MaxWindowE ¶
MaxWindowE sets or restores the window max state. Wayland backends without trustworthy compositor support return an explicit unsupported error.
func MicroSleep
deprecated
func MinWindowE ¶
MinWindowE sets the window min state and returns an explicit unsupported error on Wayland sessions.
func MouseClick
deprecated
func MouseClick(args ...interface{})
Deprecated: use the Click(),
MouseClick click the mouse ¶
robotgo.MouseClick(button string, double bool)
func MouseReady ¶
func MouseReady() error
MouseReady reports whether the active display backend can inject mouse input. On Wayland it performs a real virtual-pointer protocol probe.
func Move ¶
Move move the mouse to (x, y)
Examples:
robotgo.MouseSleep = 100 // 100 millisecond robotgo.Move(10, 10)
func MoveClick ¶
func MoveClick(x, y int, args ...interface{})
MoveClick move and click the mouse
robotgo.MoveClick(x, y int, button string, double bool)
Examples:
robotgo.MouseSleep = 100 robotgo.MoveClick(10, 10)
func MoveE ¶
MoveE moves the mouse to (x, y) and reports backend availability errors. Prefer it over Move when the caller must know whether injection succeeded.
func MoveImmediateE ¶
MoveImmediateE moves the mouse without applying the configured post-move delay. It is intended for callers that provide their own bounded schedule.
func MoveMouseSmooth
deprecated
func MoveRelativeE ¶
MoveRelativeE moves the mouse by a relative delta and reports backend availability errors.
func MoveSmooth ¶
MoveSmooth move the mouse smooth, moves mouse to x, y human like, with the mouse button up.
robotgo.MoveSmooth(x, y int, low, high float64, mouseDelay int)
Examples:
robotgo.MoveSmooth(10, 10) robotgo.MoveSmooth(10, 10, 1.0, 2.0)
func MoveSmoothRelative ¶
func MoveSmoothRelative(x, y int, args ...interface{})
MoveSmoothRelative move mouse smooth with relative
func MovesClick ¶
func MovesClick(x, y int, args ...interface{})
MovesClick move smooth and click the mouse
use the `robotgo.MouseSleep = 100`
func MultiClick ¶
MultiClick performs count single clicks and stops at the first backend error. The optional compatibility argument is accepted for source parity with upstream; RobotGo uses the same checked path on every platform.
func PasteStr ¶
PasteStr paste a string (support UTF-8), write the string to clipboard and tap `cmd + v`
func ReadAllContext ¶
func ReadAllContext(ctx context.Context, selection ...ClipboardSelection) (string, error)
ReadAllContext reads clipboard text with cancellation and explicit selection.
func RemoteDesktopInputReady ¶
func RemoteDesktopInputReady(devices RemoteDesktopDevice) error
RemoteDesktopInputReady reports whether an active portal session grants all requested devices. It never opens a session or presents a consent dialog.
func RemoteDesktopInputRestoreToken ¶
func RemoteDesktopInputRestoreToken() string
RemoteDesktopInputRestoreToken returns the latest retained session's single-use restore token, or an empty string if persistence was not granted. CloseRemoteDesktopInput removes access to the retained token.
func RemoteDesktopTouchDown ¶
RemoteDesktopTouchDown starts a touch contact on a selected stream.
func RemoteDesktopTouchMotion ¶
RemoteDesktopTouchMotion moves a touch contact on a selected stream.
func RemoteDesktopTouchUp ¶
RemoteDesktopTouchUp ends a touch contact.
func ResolveWindowHandleE ¶
ResolveWindowHandleE resolves a process ID to one validated X11 window handle, or validates the supplied handle when args is non-empty.
func SaveCapture ¶
SaveCapture capture screen and save the screenshot to image
func SaveCaptureGo ¶
SaveCaptureGo captures and saves an image. It is an upstream-compatible alias for SaveCapture.
func ScreenCastCaptureReady ¶
func ScreenCastCaptureReady() error
ScreenCastCaptureReady reports whether a reusable PipeWire capture is active.
func ScreenCastCaptureRestoreToken ¶
func ScreenCastCaptureRestoreToken() string
ScreenCastCaptureRestoreToken returns the latest single-use restore token.
func Scroll ¶
Scroll scroll the mouse to (x, y)
robotgo.Scroll(x, y, msDelay int)
Examples:
robotgo.Scroll(10, 10)
func ScrollDir ¶
func ScrollDir(x int, direction ...interface{})
ScrollDir scroll the mouse with direction to (x, "up") supported: "up", "down", "left", "right"
Examples:
robotgo.ScrollDir(10, "down") robotgo.ScrollDir(10, "up")
func ScrollImmediateE ¶
ScrollImmediateE scrolls without applying a configured or per-call post-event delay. It is intended for callers that provide bounded scheduling.
func ScrollRelative ¶
ScrollRelative scroll mouse with relative
Examples:
robotgo.ScrollRelative(10, 10)
func ScrollSmooth ¶
ScrollSmooth scroll the mouse smooth, default scroll 5 times and sleep 100 millisecond
robotgo.ScrollSmooth(toy, num, sleep, tox)
Examples:
robotgo.ScrollSmooth(-10) robotgo.ScrollSmooth(-10, 6, 200, -10)
func SetActiveE ¶
SetActiveE sets the active window and returns an explicit unsupported error for Wayland sessions where global window activation is not available.
func SetDelay ¶
func SetDelay(d ...int)
SetDelay sets the key and mouse delay robotgo.SetDelay(100) option the robotgo.KeySleep and robotgo.MouseSleep = d
func SetHandlePid ¶
SetHandlePid set the window handle by pid
func SetRuntimeConfig ¶
func SetRuntimeConfig(config RuntimeConfig) error
SetRuntimeConfig atomically replaces the defaults used by package-level APIs. Direct writes to MouseSleep, KeySleep, DisplayID, NotPid, and Scale remain supported for compatibility, but must not race with active operations.
func SetTopMost ¶
func SetTopMost(state bool)
SetTopMost updates topmost state for platforms that support it.
func SetTopMostE ¶
SetTopMostE updates topmost state and returns an explicit unsupported error on Linux backends without reliable topmost support.
func SetWaylandBackend ¶
func SetWaylandBackend(b WaylandBackend)
SetWaylandBackend allows tests and callers to force a specific Wayland capture backend.
func SetXDisplayName ¶
SetXDisplayName set XDisplay name (Linux)
func StartRemoteDesktopInput ¶
func StartRemoteDesktopInput(ctx context.Context, devices RemoteDesktopDevice) error
StartRemoteDesktopInput opens a consent-aware portal session and makes it available to supported high-level input APIs when native Wayland input is unavailable. Replacing an existing session closes the old one.
func StartRemoteDesktopInputWithOptions ¶
func StartRemoteDesktopInputWithOptions(ctx context.Context, options RemoteDesktopInputOptions) error
StartRemoteDesktopInputWithOptions opens a consent-aware input session and optionally selects ScreenCast sources for absolute pointer and touch input.
func StartScreenCastCapture ¶
func StartScreenCastCapture(ctx context.Context, options ScreenCastCaptureOptions, streamIndex ...int) error
StartScreenCastCapture opens one consent-aware ScreenCast/PipeWire session. CaptureScreen reuses it after native Wayland screencopy is unavailable, or immediately when ROBOTGO_WAYLAND_BACKEND=screencast is selected.
func ToByteImg ¶
ToByteImg serializes an image as standard Base64 with legacy trailing zero bytes. The default format is JPEG at quality 70; explicit formats are jpeg, png, gif, bmp and tiff. Only the first format is used. Encoding failure returns nil.
func ToInterfaces ¶
func ToInterfaces(fields []string) []interface{}
ToInterfaces convert []string to []interface{}
func ToMMBitmapRef ¶
func ToMMBitmapRef(bit CBitmap) C.MMBitmapRef
ToMMBitmapRef trans CBitmap to C.MMBitmapRef
func ToStrBitmap ¶
ToStrBitmap serializes a Bitmap into a stable JSON/base64 string.
func ToStringImg ¶
ToStringImg returns the exact ToByteImg representation as a string, including its trailing zero bytes. Encoding failure returns an empty string.
func ToStrings ¶
func ToStrings(fields []interface{}) []string
ToStrings convert []interface{} to []string
func Toggle ¶
func Toggle(key ...interface{}) error
Toggle toggle the mouse, support button:
"left", "center", "right", "wheelDown", "wheelUp", "wheelLeft", "wheelRight"
Examples:
robotgo.Toggle("left") // default is down
robotgo.Toggle("left", "up")
func TypeStr ¶
TypeStr send a string (supported UTF-8)
robotgo.TypeStr(string: "The string to send", int: pid, "milli_sleep time", "x11 option")
Examples:
robotgo.TypeStr("abc@123, Hi galaxy, こんにちは")
robotgo.TypeStr("To be or not to be, this is questions.", pid int)
func TypeStrDelay ¶
TypeStrDelay type string with delayed And you can use robotgo.KeySleep = 100 to delayed not this function
func TypeStrImmediateE ¶
TypeStrImmediateE sends a UTF-8 string without applying the configured post-input delay. Explicit per-rune delay arguments remain honored.
func TypeStringDelayed
deprecated
func UnicodeTypeE ¶
UnicodeTypeE types one Unicode code point and reports backend availability errors.
func WriteAllContext ¶
func WriteAllContext(ctx context.Context, text string, selection ...ClipboardSelection) error
WriteAllContext writes clipboard text with cancellation and explicit selection.
Types ¶
type Bitmap ¶
type Bitmap struct {
ImgBuf *uint8
Width, Height int
Bytewidth int
BitsPixel uint8
BytesPerPixel uint8
// contains filtered or unexported fields
}
Bitmap define the go Bitmap struct
The common type conversion of bitmap:
https://github.com/marang/robotgo/blob/master/docs/keys.md#type-conversion
func BitmapFromStr ¶
BitmapFromStr decodes a bitmap string produced by ToStrBitmap.
func ImgToBitmap ¶
ImgToBitmap convert the standard image.Image to Bitmap
func ImgToBitmapE ¶
ImgToBitmapE validates and converts an image.Image to an owned Bitmap.
func NewBitmap ¶
func NewBitmap(data []byte, width, height, bytewidth int, bitsPixel, bytesPerPixel uint8) (Bitmap, error)
NewBitmap validates and copies raw pixel data into a RobotGo-owned Bitmap. Use this constructor instead of assigning ImgBuf to arbitrary memory.
func RGBAToBitmap ¶
RGBAToBitmap convert the standard image.RGBA to Bitmap
func RGBAToBitmapE ¶
RGBAToBitmapE validates and converts an image.RGBA to an owned Bitmap.
type CBitmap ¶
type CBitmap = C.MMBitmapRef
CBitmap define CBitmap as C.MMBitmapRef type
func ByteToCBitmapE ¶
ByteToCBitmapE decodes image bytes and returns any decode or bitmap error.
func CaptureScreen ¶
CaptureScreen capture the screen and return a bitmap (C struct). Use `defer robotgo.FreeBitmap(bitmap)` to free the bitmap.
robotgo.CaptureScreen(x, y, w, h int)
func ImgToCBitmap ¶
ImgToCBitmap trans image.Image to CBitmap
func ImgToCBitmapE ¶
ImgToCBitmapE converts an image to a validated C bitmap.
func ToCBitmap ¶
ToCBitmap trans Bitmap to C.MMBitmapRef. Invalid input returns nil; callers that need the validation error should use ToCBitmapE.
func ToCBitmapE ¶
ToCBitmapE validates and copies a Go Bitmap into C-owned memory.
type CaptureBackend ¶
type CaptureBackend string
CaptureBackend reports which backend handled the most recent screen capture.
const ( BackendNone CaptureBackend = "" BackendScreencopy CaptureBackend = "screencopy" BackendPortal CaptureBackend = "portal" BackendScreenCast CaptureBackend = "screencast" BackendX11 CaptureBackend = "x11" BackendPureGo CaptureBackend = "pure-go" )
func LastBackend ¶
func LastBackend() CaptureBackend
LastBackend returns the backend used for the last CaptureScreen call.
type ClipboardSelection ¶
ClipboardSelection identifies the clipboard selection to access.
type DisplayServer ¶
type DisplayServer string
DisplayServer identifies the active Linux display server.
const ( // DisplayServerX11 represents an X11 display server. DisplayServerX11 DisplayServer = "x11" // DisplayServerWayland represents a Wayland display server. DisplayServerWayland DisplayServer = "wayland" // DisplayServerUnknown indicates no known display server was detected. DisplayServerUnknown DisplayServer = "unknown" )
func DetectDisplayServer ¶
func DetectDisplayServer() DisplayServer
DetectDisplayServer inspects the environment and reports the active display server. It checks the standard DISPLAY and WAYLAND_DISPLAY variables. If neither is present, DisplayServerUnknown is returned.
type FeatureCapability ¶
type FeatureCapability struct {
Available bool
Fallback bool
Backend string
Reason string
Notes string
}
FeatureCapability describes runtime availability for a feature backend.
type Handle ¶
Handle define window Handle as C.MData type
func GetActiveE ¶
GetActiveE gets the active window or returns an explicit backend error. Wayland backends return ErrNotSupported unless the compositor exposes a stable foreign-window handle contract.
func GetHandByPid ¶
GetHandByPid get handle mdata by pid
func GetHandPid
deprecated
type LinuxCapabilities ¶
type LinuxCapabilities struct {
DisplayServer DisplayServer
Compositor string
WaylandSession bool
X11Session bool
Capture FeatureCapability
Bounds FeatureCapability
Keyboard FeatureCapability
Mouse FeatureCapability
RemoteDesktop FeatureCapability
Accessibility FeatureCapability
Window FeatureCapability
Hook FeatureCapability
Events FeatureCapability
}
LinuxCapabilities summarizes runtime backend availability on Linux.
func GetLinuxCapabilities ¶
func GetLinuxCapabilities() LinuxCapabilities
GetLinuxCapabilities reports runtime feature availability for Linux sessions. On non-Linux platforms it returns a zero-value capability set.
type Rect ¶
Rect is rect structure
func GetScreenRect ¶
GetScreenRect get the screen rect (x, y, w, h)
func GetScreenRectE ¶
GetScreenRectE returns a screen rectangle and reports unavailable or empty backend results explicitly.
type RemoteDesktopCursorMode ¶
type RemoteDesktopCursorMode = inputportal.CursorMode
RemoteDesktopCursorMode controls cursor representation in selected streams.
type RemoteDesktopDevice ¶
type RemoteDesktopDevice = inputportal.DeviceType
RemoteDesktopDevice is a device mask for consent-aware portal input.
const ( // RemoteDesktopKeyboard requests keyboard injection permission. RemoteDesktopKeyboard RemoteDesktopDevice = inputportal.DeviceKeyboard // RemoteDesktopPointer requests pointer injection permission. RemoteDesktopPointer RemoteDesktopDevice = inputportal.DevicePointer // RemoteDesktopTouchscreen requests touch injection and requires ScreenCast sources. RemoteDesktopTouchscreen RemoteDesktopDevice = inputportal.DeviceTouchscreen )
type RemoteDesktopInputOptions ¶
type RemoteDesktopInputOptions = inputportal.OpenOptions
RemoteDesktopInputOptions configures devices and optional ScreenCast sources.
type RemoteDesktopInputStatus ¶
type RemoteDesktopInputStatus struct {
PortalAvailable bool
PortalVersion uint32
AvailableDevices RemoteDesktopDevice
ScreenCastVersion uint32
AvailableSources RemoteDesktopSource
AvailableCursorModes RemoteDesktopCursorMode
ScreenCastReason string
Permission RemoteDesktopPermissionStatus
SessionActive bool
GrantedDevices RemoteDesktopDevice
Streams []RemoteDesktopStream
RestoreTokenAvailable bool
Reason string
}
RemoteDesktopInputStatus reports portal protocol support and the current consent session without opening a dialog or exposing restore-token contents.
func GetRemoteDesktopInputStatus ¶
func GetRemoteDesktopInputStatus(ctx context.Context) (RemoteDesktopInputStatus, error)
GetRemoteDesktopInputStatus probes portal capabilities and reports the active consent state. It never opens a session or displays a permission dialog.
type RemoteDesktopPermissionStatus ¶
type RemoteDesktopPermissionStatus string
RemoteDesktopPermissionStatus describes the last consent-session outcome.
const ( RemoteDesktopPermissionNotRequested RemoteDesktopPermissionStatus = "not-requested" RemoteDesktopPermissionGranted RemoteDesktopPermissionStatus = "granted" RemoteDesktopPermissionClosed RemoteDesktopPermissionStatus = "closed" RemoteDesktopPermissionCancelled RemoteDesktopPermissionStatus = "cancelled" RemoteDesktopPermissionTimedOut RemoteDesktopPermissionStatus = "timed-out" RemoteDesktopPermissionDenied RemoteDesktopPermissionStatus = "denied" RemoteDesktopPermissionFailed RemoteDesktopPermissionStatus = "failed" )
type RemoteDesktopPersistMode ¶
type RemoteDesktopPersistMode = inputportal.PersistMode
RemoteDesktopPersistMode controls portal permission persistence.
type RemoteDesktopSource ¶
type RemoteDesktopSource = inputportal.SourceType
RemoteDesktopSource is a ScreenCast source mask used for absolute input.
type RemoteDesktopStream ¶
type RemoteDesktopStream = inputportal.Stream
RemoteDesktopStream describes a selected stream's logical coordinate space.
func RemoteDesktopInputStreams ¶
func RemoteDesktopInputStreams() ([]RemoteDesktopStream, error)
RemoteDesktopInputStreams returns the selected ScreenCast stream metadata.
type RuntimeBackendInfo ¶
type RuntimeBackendInfo struct {
GOOS string
GOARCH string
CGOEnabled bool
BuildImplementation RuntimeImplementation
DisplayServer DisplayServer
}
RuntimeBackendInfo describes the implementation compiled into the current binary. Use GetLinuxCapabilities for feature-specific Linux backend status.
func GetRuntimeBackendInfo ¶
func GetRuntimeBackendInfo() RuntimeBackendInfo
GetRuntimeBackendInfo reports build-time backend information without probing portals, compositors, permissions, or other external services.
type RuntimeCapabilities ¶
type RuntimeCapabilities struct {
Runtime RuntimeBackendInfo
// Compositor is the detected Linux Wayland compositor family. It is empty
// on other platforms and display servers.
Compositor string
Capture FeatureCapability
Bounds FeatureCapability
Keyboard FeatureCapability
Mouse FeatureCapability
RemoteDesktop FeatureCapability
Accessibility FeatureCapability
Window FeatureCapability
Process FeatureCapability
Clipboard FeatureCapability
Hook FeatureCapability
Events FeatureCapability
}
RuntimeCapabilities reports feature-level backend availability for the current platform and build. Availability may include bounded runtime probes; inspecting RuntimeBackendInfo never performs those probes.
func GetRuntimeCapabilities ¶
func GetRuntimeCapabilities() RuntimeCapabilities
GetRuntimeCapabilities reports the feature backends available to the current binary. Unlike GetRuntimeBackendInfo, this function may perform bounded platform probes, but it never opens a consent dialog.
type RuntimeConfig ¶
type RuntimeConfig struct {
MouseDelay int
KeyDelay int
DisplayID int
TreatAsHandle bool
Scale bool
}
RuntimeConfig contains process-wide defaults used by legacy package-level APIs. Prefer explicit per-call arguments where available.
func GetRuntimeConfig ¶
func GetRuntimeConfig() RuntimeConfig
GetRuntimeConfig returns one consistent snapshot of the legacy defaults.
type RuntimeDiagnostics ¶
type RuntimeDiagnostics struct {
SchemaVersion string `json:"schema_version"`
Runtime RuntimeIdentityDiagnostic `json:"runtime"`
DisplayServer DisplayServer `json:"display_server,omitempty"`
Compositor string `json:"compositor,omitempty"`
Features []RuntimeFeatureDiagnostic `json:"features"`
Protocols []RuntimeProtocolDiagnostic `json:"protocols,omitempty"`
Permissions []RuntimePermissionDiagnostic `json:"permissions,omitempty"`
Remediation []RuntimeRemediation `json:"remediation,omitempty"`
}
RuntimeDiagnostics is the versioned, machine-readable runtime support report. Feature and protocol ordering is stable within a schema version.
func GetRuntimeDiagnostics ¶
func GetRuntimeDiagnostics(ctx context.Context) RuntimeDiagnostics
GetRuntimeDiagnostics reports backend, protocol, permission, and remediation information without opening a consent dialog. Feature discovery retains its existing bounded probes; the additional structured portal probes use the supplied deadline or a bounded default.
type RuntimeFeatureDiagnostic ¶
type RuntimeFeatureDiagnostic struct {
Name string `json:"name"`
Available bool `json:"available"`
Fallback bool `json:"fallback"`
Backend string `json:"backend,omitempty"`
Reason string `json:"reason,omitempty"`
Notes string `json:"notes,omitempty"`
}
RuntimeFeatureDiagnostic is a stable, named view of one feature capability.
type RuntimeIdentityDiagnostic ¶
type RuntimeIdentityDiagnostic struct {
RobotGoVersion string `json:"robotgo_version"`
GOOS string `json:"goos"`
GOARCH string `json:"goarch"`
CGOEnabled bool `json:"cgo_enabled"`
BuildImplementation RuntimeImplementation `json:"build_implementation"`
}
RuntimeIdentityDiagnostic is the sanitized build identity included in a versioned diagnostic report.
type RuntimeImplementation ¶
type RuntimeImplementation string
RuntimeImplementation identifies how the current RobotGo binary was built.
type RuntimePermissionDiagnostic ¶
type RuntimePermissionDiagnostic struct {
Feature string `json:"feature"`
Name string `json:"name"`
State RuntimePermissionState `json:"state"`
Reason string `json:"reason,omitempty"`
}
RuntimePermissionDiagnostic reports permission state without requesting consent or exposing tokens and other sensitive session data.
type RuntimePermissionState ¶
type RuntimePermissionState string
RuntimePermissionState describes a permission or consent state without opening a system dialog.
const ( RuntimePermissionUnknown RuntimePermissionState = "unknown" RuntimePermissionNotRequired RuntimePermissionState = "not-required" RuntimePermissionNotRequested RuntimePermissionState = "not-requested" RuntimePermissionGranted RuntimePermissionState = "granted" RuntimePermissionDenied RuntimePermissionState = "denied" RuntimePermissionCancelled RuntimePermissionState = "cancelled" RuntimePermissionTimedOut RuntimePermissionState = "timed-out" RuntimePermissionClosed RuntimePermissionState = "closed" RuntimePermissionFailed RuntimePermissionState = "failed" )
type RuntimeProtocolDiagnostic ¶
type RuntimeProtocolDiagnostic struct {
Feature string `json:"feature"`
Name string `json:"name"`
Version string `json:"version,omitempty"`
Negotiated bool `json:"negotiated"`
Reason string `json:"reason,omitempty"`
}
RuntimeProtocolDiagnostic reports a protocol version negotiated with the active compositor, display server, or desktop portal.
type RuntimeRemediation ¶
RuntimeRemediation describes one actionable step for an unavailable feature.
type ScreenCastCaptureCursor ¶
type ScreenCastCaptureCursor = portalpkg.ScreenCastCursor
type ScreenCastCaptureOptions ¶
type ScreenCastCaptureOptions = portalpkg.ScreenCastOptions
type ScreenCastCapturePersist ¶
type ScreenCastCapturePersist = portalpkg.ScreenCastPersist
type ScreenCastCaptureSource ¶
type ScreenCastCaptureSource = portalpkg.ScreenCastSource
type ScreenCastCaptureStream ¶
type ScreenCastCaptureStream = portalpkg.ScreenCastStream
func ScreenCastCaptureStreams ¶
func ScreenCastCaptureStreams() ([]ScreenCastCaptureStream, error)
ScreenCastCaptureStreams returns selected portal stream metadata.
type WaylandBackend ¶
type WaylandBackend int
WaylandBackend selects which Wayland backend to use at runtime.
const ( WaylandBackendAuto WaylandBackend = -1 WaylandBackendDmabuf WaylandBackend = 0 WaylandBackendWlShm WaylandBackend = 1 )
Source Files
¶
- accessibility_capability_linux.go
- alert_result.go
- backend_info.go
- backend_info_cgo.go
- bitmap_common.go
- bitmap_facade_cgo.go
- capabilities_cgo.go
- capture_args.go
- capture_facade_cgo.go
- capture_image_cleanup.go
- capture_policy_cgo.go
- capture_state_cgo.go
- clipboard_context.go
- clipboard_helpers_cgo.go
- display_policy_cgo.go
- doc.go
- errors_cgo.go
- img.go
- input_affinity_cgo.go
- input_lifecycle_cgo.go
- input_validation.go
- key.go
- key_constants_cgo.go
- key_helpers_cgo.go
- key_native_cgo.go
- key_ownership_cgo.go
- key_policy_cgo.go
- key_text_cgo.go
- keycode.go
- legacy_args.go
- mouse_convenience_cgo.go
- mouse_ownership_cgo.go
- mouse_policy_cgo.go
- native_adapter_cgo.go
- process_kill_pid_unix.go
- ps.go
- remote_desktop_input.go
- remote_desktop_input_status.go
- remote_desktop_input_stream.go
- remote_desktop_keys.go
- robotgo.go
- robotgo_adb.go
- robotgo_fn_v1.go
- robotgo_linux_alert.go
- robotgo_linux_x11.go
- robotgo_mac_unix.go
- robotgo_ocr_cli.go
- runtime_capabilities_cgo.go
- runtime_capabilities_cgo_default.go
- runtime_config.go
- runtime_config_cgo.go
- runtime_diagnostics.go
- runtime_diagnostics_linux.go
- runtime_types_cgo.go
- screen.go
- screen_backend_linux_cgo.go
- screen_backend_linux_dispatch.go
- screen_bounds_error.go
- screen_bounds_policy_cgo.go
- screencast_capture.go
- upstream_compat.go
- utilities_cgo.go
- version.go
- wayland_bounds_aggregate.go
- wayland_bounds_cache_cgo.go
- wayland_bounds_common.go
- wayland_bounds_parser_cgo.go
- wayland_compositor.go
- wayland_output_stub.go
- window_backend.go
- window_facade_cgo.go
- window_geometry_backend.go
- windows_n.go
- x11_display_check_linux_x11.go
- x11_window_property_linux_cgo.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package agent provides a typed, policy-gated session layer above RobotGo's low-level compatibility API.
|
Package agent provides a typed, policy-gated session layer above RobotGo's low-level compatibility API. |
|
mcpserver
Package mcpserver exposes an agent Session through a small, local-only MCP tool surface.
|
Package mcpserver exposes an agent Session through a small, local-only MCP tool surface. |
|
https://github.com/golang/go/issues/26366
|
https://github.com/golang/go/issues/26366 |
|
Package clipboard read/write on clipboard
|
Package clipboard read/write on clipboard |
|
cmd/gocopy
command
|
|
|
cmd/gopaste
command
|
|
|
example
command
|
|
|
cmd
|
|
|
robotgo-mcp
command
Command robotgo-mcp serves one policy-gated RobotGo agent session over MCP stdio.
|
Command robotgo-mcp serves one policy-gated RobotGo agent session over MCP stdio. |
|
agent_actions
command
Command agent_actions demonstrates the extended, policy-gated RobotGo agent actions.
|
Command agent_actions demonstrates the extended, policy-gated RobotGo agent actions. |
|
agent_conditions
command
|
|
|
agent_image_analysis
command
Command agent_image_analysis demonstrates explicit, observation-bound local OCR or visual element proposals for a self-owned desktop region.
|
Command agent_image_analysis demonstrates explicit, observation-bound local OCR or visual element proposals for a self-owned desktop region. |
|
agent_session
command
|
|
|
capture_helpers
command
|
|
|
display_bounds
command
|
|
|
key
command
|
|
|
linux_capabilities
command
|
|
|
mouse
command
|
|
|
purego_macos_input
command
Command purego_macos_input demonstrates permission-aware Pure-Go keyboard automation on macOS without injecting input unless -act is supplied.
|
Command purego_macos_input demonstrates permission-aware Pure-Go keyboard automation on macOS without injecting input unless -act is supplied. |
|
purego_macos_pointer
command
Command purego_macos_pointer demonstrates permission-aware Pure-Go pointer automation on macOS.
|
Command purego_macos_pointer demonstrates permission-aware Pure-Go pointer automation on macOS. |
|
purego_macos_window
command
|
|
|
purego_windows_input
command
Command purego_windows_input demonstrates the non-CGO Windows input backend.
|
Command purego_windows_input demonstrates the non-CGO Windows input backend. |
|
purego_windows_window
command
|
|
|
purego_x11_input
command
|
|
|
purego_x11_window
command
|
|
|
remote_desktop_input
command
|
|
|
runtime_capabilities
command
|
|
|
runtime_diagnostics
command
Command runtime_diagnostics prints RobotGo's versioned, sanitized runtime support report without requesting desktop consent.
|
Command runtime_diagnostics prints RobotGo's versioned, sanitized runtime support report without requesting desktop consent. |
|
scale
command
|
|
|
screen
command
|
|
|
screen_full
command
|
|
|
screencast_capture
command
Command screencast_capture demonstrates reusable Wayland ScreenCast capture.
|
Command screencast_capture demonstrates reusable Wayland ScreenCast capture. |
|
semantic_element_action
command
Command semantic_element_action inspects one self-owned accessible window, resolves and toggles one uniquely named checkbox or switch, verifies the opposite checked state, records the semantic workflow, and returns both the privacy-tiered Trace and deterministic Go/MCP flow artifacts.
|
Command semantic_element_action inspects one self-owned accessible window, resolves and toggles one uniquely named checkbox or switch, verifies the opposite checked state, records the semantic workflow, and returns both the privacy-tiered Trace and deterministic Go/MCP flow artifacts. |
|
semantic_ui
command
Command semantic_ui prints one bounded native accessibility snapshot for an explicitly selected process/window and exact title.
|
Command semantic_ui prints one bounded native accessibility snapshot for an explicitly selected process/window and exact title. |
|
target_evidence_review
command
Command target_evidence_review demonstrates a non-executable TargetSpec v2 review using one explicitly selected visual proposal from a self-owned GUI.
|
Command target_evidence_review demonstrates a non-executable TargetSpec v2 review using one explicitly selected visual proposal from a self-owned GUI. |
|
verified_flow_planner
command
Program verified_flow_planner demonstrates advisory capability planning for one semantic resolve-act-verify transaction.
|
Program verified_flow_planner demonstrates advisory capability planning for one semantic resolve-act-verify transaction. |
|
wayland_window_state
command
|
|
|
window
command
|
|
|
window_geometry
command
|
|
|
window_identity
command
|
|
|
input
|
|
|
portal
Package portal provides consent-aware Wayland input through the freedesktop RemoteDesktop portal.
|
Package portal provides consent-aware Wayland input through the freedesktop RemoteDesktop portal. |
|
internal
|
|
|
accessibility
Package accessibility provides bounded, read-only native accessibility discovery without exposing platform object references outside the process.
|
Package accessibility provides bounded, read-only native accessibility discovery without exposing platform object references outside the process. |
|
benchcmp
Package benchcmp compares Go benchmark output without applying pass/fail thresholds.
|
Package benchcmp compares Go benchmark output without applying pass/fail thresholds. |
|
cmd/apicompat
command
|
|
|
cmd/benchcompare
command
|
|
|
cmd/compositorevidence
command
|
|
|
cmd/portalrunner
command
|
|
|
cmd/releaseevidence
command
|
|
|
cmd/supportmatrix
command
Command supportmatrix checks or updates the generated Runtime Compatibility Matrix table from its machine-readable contract.
|
Command supportmatrix checks or updates the generated Runtime Compatibility Matrix table from its machine-readable contract. |
|
command
Package command provides the bounded lifecycle used by RobotGo's one-shot external command backends.
|
Package command provides the bounded lifecycle used by RobotGo's one-shot external command backends. |
|
compositorevidence
Package compositorevidence creates privacy-safe evidence for protected real-compositor integration jobs.
|
Package compositorevidence creates privacy-safe evidence for protected real-compositor integration jobs. |
|
darwininput
Package darwininput provides RobotGo's Pure-Go macOS input backend.
|
Package darwininput provides RobotGo's Pure-Go macOS input backend. |
|
darwinwindow
Package darwinwindow provides RobotGo's Pure-Go macOS window backend.
|
Package darwinwindow provides RobotGo's Pure-Go macOS window backend. |
|
portalrunner
Package portalrunner validates protected ephemeral portal-runner definitions and owns their host-side temporary state.
|
Package portalrunner validates protected ephemeral portal-runner definitions and owns their host-side temporary state. |
|
releaseevidence
Package releaseevidence creates and verifies versioned RobotGo release evidence snapshots.
|
Package releaseevidence creates and verifies versioned RobotGo release evidence snapshots. |
|
waylandoutput
Package waylandoutput provides bounded, read-only Wayland output discovery.
|
Package waylandoutput provides bounded, read-only Wayland output discovery. |
|
windowbackend
Package windowbackend defines the platform-neutral contract shared by Pure-Go window implementations.
|
Package windowbackend defines the platform-neutral contract shared by Pure-Go window implementations. |
|
windowsinput
Package windowsinput provides RobotGo's Pure-Go Windows input backend.
|
Package windowsinput provides RobotGo's Pure-Go Windows input backend. |
|
x11window
Package x11window implements the Pure-Go X11 window contract.
|
Package x11window implements the Pure-Go X11 window contract. |