Skip to main content

pywaylandauto

Wayland 键盘鼠标输入注入工具。通过 EIS (Emulated Input Server) 或 wlroots 虚拟输入协议实现全局鼠标键盘控制。

当前适配 Kylin V11 (kylin-wlcom)。UOS、Ubuntu 等发行版规划中。

安装

git clone https://github.com/.../pywaylandauto.git
cd pywaylandauto
python3 -m venv --system-site-packages .venv
.venv/bin/pip install -e .

快速开始

pywaylandauto daemon start          # 启动后台 daemon
pywaylandauto move 960 540          # 移动鼠标
pywaylandauto click 500 300         # 左键点击
pywaylandauto right-click 500 300   # 右键点击
pywaylandauto input "Hello 世界"    # 输入文本(中文通过剪贴板粘贴)
pywaylandauto key ctrl c            # 组合键 Ctrl+C
pywaylandauto daemon stop           # 停止 daemon

CLI 命令

Daemon

命令 说明
pywaylandauto daemon start 启动 daemon(后台运行)
pywaylandauto daemon stop 停止 daemon
pywaylandauto daemon status daemon 进程状态
pywaylandauto status 完整状态:daemon、backend、坐标、缩放比

鼠标

命令 说明
move X Y 绝对移动
move-rel DX DY 相对移动
click X Y [--button] 点击
right-click X Y 右键点击
middle-click X Y 中键点击
double-click X Y 双击
mouse-down X Y [--button] 按下
mouse-up X Y [--button] 释放
drag X1 Y1 X2 Y2 拖拽
scroll X Y [--dx] [--dy] 滚轮

键盘

命令 说明
input TEXT 输入文本
key KEY [KEY...] 按键(多键=组合键)
key-down KEY 按下不放
key-up KEY 释放

Python API

import pywaylandauto

pywaylandauto.move(960, 540)
pywaylandauto.click(500, 300)
pywaylandauto.right_click(500, 300)
pywaylandauto.double_click(500, 300)
pywaylandauto.mouse_down(100, 100)
pywaylandauto.mouse_up(500, 300)
pywaylandauto.drag(100, 100, 500, 300)
pywaylandauto.scroll(300, 200, dy=3)
pywaylandauto.input("Hello")
pywaylandauto.key("ctrl", "c")
pywaylandauto.key_down("shift")
pywaylandauto.key_up("shift")

pos = pywaylandauto.mouse_position()  # {'x': 500.0, 'y': 300.0}

首次调用自动启动 daemon。坐标使用物理像素,daemon 自动按缩放比转换。

架构

CLI / Python API
    └── Client (UNIX socket + JSON 协议)
          └── Daemon (GLib 主循环)
                ├── EIS Backend  ──→ com.kylin.Wlcom.EIS.RemoteDesktop
                └── Wlroots Backend (回退) ──→ Wayland socket
  • Socket:$XDG_RUNTIME_DIR/pywaylandauto.sock(0600)
  • 无授权弹窗,daemon 启动即连接
  • 坐标自动物理像素 → 逻辑坐标转换

路线图

  • Kylin V11 (kylin-wlcom) — EIS + wlroots 双后端
  • UOS — EIS D-Bus 入口适配
  • Ubuntu / GNOME — XDG Desktop Portal RemoteDesktop 入口适配
  • Sway / Hyprland — wlroots backend 开箱可用,需验证

许可

MIT

Metadata

Release files for pywaylandauto 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywaylandauto 0.1.0
File Size Uploaded
pywaylandauto-0.1.0.tar.gz 37.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pywaylandauto 0.1.0
File Interpreter ABI Platform
pywaylandauto-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 75.1 kB

Release files / pywaylandauto-0.1.0.tar.gz

Download URL pywaylandauto-0.1.0.tar.gz
Size 37.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5c9b352ce6f14325846b21201aa6071586e8ec9eb78ee70b5edc7b91b44cc3c3
BLAKE2b-256 checksum
How to use checksums
28b063434a6d414395a5325a602a9ab7eb9a457d7a85e48a2c0ba6306614c997
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / pywaylandauto-0.1.0-py3-none-any.whl

Download URL pywaylandauto-0.1.0-py3-none-any.whl
Size 37.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
214773e0500e3f7ae8428d33c6fb509645aaae57ea85b76996cf3925db020dcc
BLAKE2b-256 checksum
How to use checksums
b8fd13d21c600d013cd234f86303b5c2eb6f301b0758a2d1fc241f414a431f49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release history Release notifications | RSS feed

1.0.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page