input

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

README

native/input

合成鼠标、键盘事件:移动、点击、按键。

  • 依赖:native(错误值)、native/internal/sys。
  • 单独使用:可以,不需要窗口。除读取鼠标位置外都需要辅助功能权限。
import "github.com/dyike/keel/native/input"

input.MouseMove(100, 200)
input.Click(input.Left)
input.Tap("enter")

详见 原生能力 · input。

Documentation

Overview

Package input synthesizes mouse and keyboard events. Everything except MousePosition needs the Accessibility permission.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Click

func Click(b Button) error

Click clicks at the current mouse position.

func KeyDown

func KeyDown(key string) error

KeyDown and KeyUp take US-layout key names such as "a", "enter", "f5", "cmd".

func KeyUp

func KeyUp(key string) error

func MouseMove

func MouseMove(x, y float64) error

func MousePosition

func MousePosition() (x, y float64, err error)

MousePosition uses the same coordinates as screen.Display.

func Tap

func Tap(key string) error

Tap presses and releases a key.

Types

type Button

type Button int
const (
	Left Button = iota
	Right
	Middle
)

Jump to

Keyboard shortcuts

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