agent-desktop-linux
它能做什么
为助手提供在 Linux 桌面上自动化应用的指南,包括每种显示系统支持哪些功能。适合希望智能体在 Linux 上读取或点击应用的人。
适用场景
- ✓当你希望助手在 Ubuntu 桌面上读取或点击应用时。
- ✓当 Linux 自动化命令没有显示任何应用,或无障碍总线似乎有问题时。
- ✓当你需要知道哪些命令在 X11 或 Wayland 上可用时。
技能链接
https://github.com/NanmiCoder/cc-haha/blob/main/native/agent-desktop/skills/agent-desktop-linux/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“你能读取我 Ubuntu 桌面上打开的窗口,并告诉我文件管理器里有什么吗?”
每周 5 个新技能,1 分钟读完。
工作原理
指南会说明所需的桌面设置,例如无障碍总线,并列出哪些命令在 X11 和 Wayland 上可用。助手会按步骤操作,以查看或操作应用的控件。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
agent-desktop-linux
The observe-act loop, refs, JSON envelope, sessions and tracing match every platform. This file covers only what differs on Linux.
Needs Ubuntu 24.04+ (x86_64 or aarch64), a graphical session of the signed-in
user and a running AT-SPI bus. Other distributions need the at-spi2-core bridge
fix dc0dc33; Ubuntu 22.04's bridge aborts on Action.GetActions. The archive
loader floor is glibc 2.35. Run the CLI inside the target apps' desktop session:
the session bus, display and runtime directory come from its environment. A TTY
login, an SSH shell without session variables, a container without a bus or
another user's session sees no apps. GNOME is the measured desktop; X11 and
Wayland sessions both work and differ in input, capture and window control.
Observation and semantic actions need no helper tool.
Capability Table
| Group | Commands | Status on Linux |
|---|---|---|
| Observation | snapshot, find, get, is |
Works on X11 and Wayland through AT-SPI. Supports window, sheet, alert and menu; GNOME adds shell surfaces. Virtual tray getters have limits; see the shell reference and check status |
| Surfaces | list-surfaces |
Lists an app's windows, sheets and open menus; shell reads use snapshot --surface |
| Ref interaction | click, right-click, type, set-value, clear, select, toggle, check, uncheck, expand, collapse, scroll-to |
Need a readable live identity and the required AT-SPI capability. See the shell reference for menu-ref resolution limits; X11 headed fallback also needs usable geometry and does not bypass identity checks |
| Wheel scrolling | scroll, mouse-wheel |
Physical wheel input; X11 and --headed only |
| Pointer gestures | double-click, triple-click, hover, drag |
--headed, X11 only. On Wayland the pointer cannot be aimed and these refuse with ACTION_NOT_SUPPORTED |
| Focus | focus |
Needs --headed for the focus permission. Calls AT-SPI Component.GrabFocus on a focusable node that is not yet focused, not the pointer, and verifies the state; a GTK4 app rejects the call, so focus ends ACTION_FAILED grab_focus_rejected there and focus-window is the way to focus its window |
| Keyboard and mouse | press, mouse-click, mouse-move, mouse-wheel |
press and text keys work on X11 and capability-detected Mutter Wayland sessions; pointer commands are X11 and --headed. See references/display-servers-and-input.md |
| Held input | key-down, key-up, mouse-down, mouse-up |
Fail closed on every platform: on Linux, key-down and key-up with ACTION_NOT_SUPPORTED; mouse-down and mouse-up with POLICY_DENIED headless and ACTION_NOT_SUPPORTED with --headed |
| App and window | launch, close-app, list-windows, list-apps, focus-window, move-window, resize-window, minimize, maximize, restore |
Launch and listing work on X11 and Wayland; focus-window requires X11. Other window control and graceful close need an X11 client. See references/windows-and-lifecycle.md |
| Displays | list-displays |
Works |
| Capture | screenshot |
X11: a window without permission; a display only under a non-compositing manager. Wayland: portal consent, with display cropping. No selector returns the primary display. See references/capture-and-clipboard.md |
| Clipboard | clipboard-get, clipboard-set, clipboard-clear |
Works; text, images and file lists. Wayland needs wl-clipboard |
| Wait | wait |
Works for ms, --element, --window, --text, --menu, --menu-closed, --event. Menu waits share the menu-surface detector; --notification waits for a new notification on GNOME |
| Notifications | list-notifications, dismiss-notification, dismiss-all-notifications, notification-action |
GNOME Shell only; list headless, mutations --headed on X11, and dismiss-notification and notification-action also need --expected-app or --expected-title. Fields are read from the shell's widget layout, verified on GNOME Shell 46.0 only, and each mutation is proven by its effect. Wayland refuses the shell pointer before input. A notification owner that is not the shell or its own helper returns PLATFORM_NOT_SUPPORTED. See the shell reference |
| Shell surfaces | open-system-surface |
Only system-tray and action-center can work. system-tray needs a StatusNotifierWatcher (else it refuses with watcher: absent); action-center needs proven |
常见问题
要让它工作需要什么?
需要已登录用户的图形会话,并运行着无障碍总线。经过测试的环境是 Ubuntu 24.04 或更高版本。
为什么它显示不了任何应用?
从普通终端或其他用户会话运行的命令可能看不到桌面应用,因此应在目标会话中运行。
在 Wayland 上效果一样吗?
不一定。输入、截图和窗口控制在 X11 和 Wayland 上有所不同。
详情
作者的原始描述
Linux platform guide for the agent-desktop CLI. Lists per command group what works on X11 and on Wayland, how to check the AT-SPI accessibility bus, the first-contact gotchas (app names, Chromium and Electron flags, headed focus, blocked key combos), and where to find lifecycle, screenshot, clipboard, tray, notification and troubleshooting details. Triggers on: "linux desktop automation", "AT-SPI tree", "automate GNOME app", "agent-desktop on Linux", "accessibility bus not available", "empty supported_surfaces", "wayland screenshot consent", or any Linux GUI interaction task.
repo: NanmiCoder/cc-haha
热度
- GitHub 星标
- 15k
- 排名
- #10914
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-desktop-ffi
15k帮助开发者直接从 Python、Swift、Node、Go 或 C++ 调用 agent-desktop 自动化库,无需为每个操作都启动命令行工具。
agent-desktop-macos
15k教你的智能体如何自动化 Mac 应用,包括授予所需权限,以及处理菜单、对话框和 Chromium 或 Electron 应用。
agent-desktop-windows
15k教你的智能体如何自动化 Windows 应用,涵盖哪些功能可用、PowerShell 引号的用法、最小化窗口以及提权应用的限制。
agent-desktop
15k让你的智能体通过读取无障碍树、点击、输入并检查结果,在 Mac、Windows 或 Linux 上查看和操作桌面应用。