返回顶部
d

desktop-control-linuxLinux桌面控制

Safe Linux desktop automation (mouse/keyboard/screenshot) with approval mode and X11/Wayland checks.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
229
下载量
免费
免费
2
收藏
概述
安装方式
版本历史

desktop-control-linux

桌面控制 (Linux)

使用PyAutoGUI在Linux上实现安全的桌面自动化,包含明确的审批和环境检查。

系统要求

  • - 带有图形会话的Linux(推荐X11)
  • Python包:
- pyautogui - pillow - pygetwindow(窗口操作;Linux不支持) - pyperclip(剪贴板操作) - opencv-python(可选,图像匹配)

系统包(通用):

  • - python3-tk、scrot、xclip或xsel
  • wmctrl(窗口列表/激活)
  • xdotool(活动窗口)

快速开始

bash
python - < from skills.desktopcontrollinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=True)
print(dc.getscreensize())
PY

截图保存到文件

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)
print(dc.screenshot_to(/tmp/screen.png))
PY

录制屏幕(ffmpeg)

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)
print(dc.record_screen(/tmp/record.mp4, seconds=30))
PY

启动Chrome并打开URL(默认等待15秒;重型应用使用15-30秒)

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)
dc.openchrome(http://localhost:8000, waitseconds=15)
PY

预设示例

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)

def presetopensite():
dc.openchrome(http://localhost:8000, waitseconds=15)

def presetloginsite():
dc.openchrome(http://localhost:8000/login, waitseconds=15)
dc.loginform(user@example.com, password, waitseconds=10)

dc.registerpreset(open-site, presetopen_site)
dc.registerpreset(login-site, presetlogin_site)

运行预设

dc.run_preset(open-site)

dc.run_preset(login-site)

PY

工作流(DSL)示例

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)
steps = [
{action: open_chrome, url: http://localhost:8000/login, wait: 15},
{action: login_form, email: user@example.com, password: secret, wait: 10},
{action: open_url, url: http://localhost:8000/target, wait: 15},
{action: screenshot, path: /tmp/target.png}
]

dc.run_steps(steps)
PY

OCR与状态检测示例

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)

从屏幕读取文本

text = dc.readtexton_screen() print(text)

等待文本出现(需要pytesseract)

if dc.waitfortext(Success, timeout=30): print(检测到文本!) PY

多显示器示例

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)

获取所有显示器

monitors = dc.get_monitors() print(monitors) # [{name: HDMI-1, x: 0, y: 0, width: 1920, height: 1080}, ...]

在第二个显示器上点击(相对坐标0.5, 0.5 = 中心)

dc.click_monitor(1, 0.5, 0.5) PY

多浏览器示例

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)

打开不同浏览器

dc.openfirefox(https://google.com, waitseconds=15) dc.openedge(https://github.com, waitseconds=15) PY

窗口管理器示例

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)

调整窗口大小为800x600

dc.resize_window(Chrome, 800, 600)

最小化窗口

dc.minimize_window(Telegram)

最大化窗口

dc.maximize_window(VSCode) PY

流程录制器示例

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)

开始录制

dc.start_recording()

执行一些操作(目前手动,或封装它们)

dc.click(x=100, y=200) dc.type_text(hello) dc.press(enter)

停止并回放

actions = dc.stop_recording() print(f录制了 {len(actions)} 个操作)

稍后回放

dc.replayactions(actions, delaymultiplier=1.0) PY

AI视觉与智能等待示例

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)

按颜色查找元素(RGB)

pos = dc.findelementby_color((255, 0, 0), tolerance=20) # 红色 if pos: dc.click(x=pos[0], y=pos[1])

智能等待 - 轮询直到条件为真

dc.smartwait(lambda: dc.activewindow_contains(Done), timeout=30) PY

拖放示例

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)

从A点拖到B点

dc.drag_drop(100, 200, 500, 600)

将文件拖到应用

dc.dragfileto_app(/path/to/file.txt, 400, 300) PY

健壮重试示例

bash python - <controllinux import DesktopControllerLinux

dc = DesktopControllerLinux(require_approval=False)

带自动重试的点击

dc.robust_click(100, 200)

带自动重试的输入

dc.robust_type(Hello world) PY

API

与DesktopController相同的接口:

  • - 鼠标:movemouse、click、drag、scroll、getmouseposition
  • 键盘:typetext、press、hotkey、wait、launchapp、openurl、openchrome、waitretrywindow、waitretrynewwindow、smartretry
  • 屏幕/UI:clickimage、clickimageor、loginform
  • 状态:ensurewindow、activewindowcontains、waitfortext、detectstate
  • 恢复:recoverreload、recoverback、retrywithrecovery
  • 工作流:runsteps
  • 预设:registerpreset、runpreset
  • OCR:readtextonscreen
  • 多显示器:getmonitors、clickmonitor
  • 健壮操作:robustclick、robusttype
  • 智能等待:smartwait、waitforwindowstable
  • 拖放:dragdrop、dragfiletoapp
  • 窗口管理器:resizewindow、minimizewindow、maximizewindow
  • 多浏览器:openfirefox、openedge
  • 键盘:detectkeyboardlayout
  • AI视觉:findelementbycolor、findbuttonvision
  • 录制器:startrecording、recordaction、stoprecording、replay_actions

launchapp(appname, waitseconds=15, windowtitle=None, autodetectwindow=True)

  • - 如果提供了window_title:等待15秒,重试一次,如果未找到则报错。
  • 如果

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 dekstop-control-linux-1776117550 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 dekstop-control-linux-1776117550 技能

通过命令行安装

skillhub install dekstop-control-linux-1776117550

下载

⬇ 下载 desktop-control-linux v1.0.0(免费)

文件大小: 10.95 KB | 发布时间: 2026-4-15 12:27

v1.0.0 最新 2026-4-15 12:27
Initial release of dekstop-control-linux — safe Linux desktop automation with approval mode and X11/Wayland checks.

- Provides desktop automation (mouse, keyboard, screenshots) for Linux with PyAutoGUI.
- Includes explicit approval mode for safety and environment/session checks.
- Supports multi-monitor, multi-browser, window management, drag-and-drop, robust retry, OCR, AI vision, recorder, and workflows.
- Extensive API examples for launching apps, screen recording, preset workflows, smart waiting, and more.
- Safety features: approval mode enabled by default, failsafe abort, and environment compatibility checks.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部