Desktop Pet
A pixel art desktop pet (default: lobster 🦞) that roams the screen as a transparent Electron overlay.
Quick Start
CODEBLOCK0
The pet starts at the bottom center of the screen and begins roaming.
HTTP API
Local API on port 18891 (127.0.0.1 only):
- -
GET /state - returns INLINECODE1 - INLINECODE2 - set state: INLINECODE3
States
| State | Behavior |
|---|
| INLINECODE4 | Gentle bob, occasional claw snap |
| INLINECODE5 |
Moves along current surface |
|
climbing | Transitions between floor/walls/ceiling |
|
fleeing | Running from cursor or active window |
|
working | Sits at tiny laptop with sparkle particles |
|
thinking | Slow sway, thought dots appear |
|
sleeping | Eyes closed, zzz bubbles float up |
|
talking | Faces user, shows speech bubble, auto-returns to idle |
|
snapping | Claw snap animation |
Agent Integration
Hit the API at the start of responses to make the pet face the user:
CODEBLOCK1
Set to working during long operations, thinking while reasoning.
The talking state auto-returns to idle after the bubble duration expires.
Auto-Launch (macOS)
Create a LaunchAgent for auto-start on login. Use label ai.openclaw.desktop-pet.
CODEBLOCK2
Replace APP_PATH with the absolute path to the app directory.
Customization
The pet is drawn programmatically via Canvas pixel art in index.html. To change the creature:
- - Edit
lobsterBase() and lobsterFront() functions with new pixel layouts - Colors are defined as constants at the top of the script block
- Each pixel is
{x, y, w, h, color} at 3x scale
Features
- - Transparent overlay, always-on-top, click-through (except on the pet itself)
- Roams full desktop: floor, walls, ceiling
- Avoids cursor (250px radius) and frontmost window
- Right-click context menu for manual state control
- Speech bubbles with auto-sizing duration
- Pixel art drawn via Canvas (no external images needed)
桌面宠物
一款像素艺术桌面宠物(默认:龙虾 🦞),以透明Electron覆盖层的形式在屏幕上漫游。
快速开始
bash
cd <技能目录>/assets/app
npm install
npx electron .
宠物从屏幕底部中央开始,并开始漫游。
HTTP API
本地API位于端口18891(仅限127.0.0.1):
- - GET /state - 返回 {state:idle,statusText:}
- POST /state - 设置状态:{state:talking,bubble:hello!}
状态
| 状态 | 行为 |
|---|
| idle | 轻柔晃动,偶尔夹钳开合 |
| walking |
沿当前表面移动 |
| climbing | 在地板/墙壁/天花板之间过渡 |
| fleeing | 逃离光标或活动窗口 |
| working | 坐在小笔记本电脑前,带有闪光粒子 |
| thinking | 缓慢摇摆,出现思考气泡 |
| sleeping | 闭眼,zzz气泡上浮 |
| talking | 面向用户,显示对话气泡,自动返回空闲状态 |
| snapping | 夹钳开合动画 |
智能体集成
在响应开始时调用API,让宠物面向用户:
bash
curl -s -X POST http://127.0.0.1:18891/state \
-H Content-Type: application/json \
-d {state:talking,bubble:正在处理...}
长时间操作时设置为working,推理时设置为thinking。
talking状态在气泡持续时间结束后自动返回idle状态。
自动启动(macOS)
创建LaunchAgent以实现登录时自动启动。使用标签ai.openclaw.desktop-pet。
bash
安装为LaunchAgent
cat > ~/Library/LaunchAgents/ai.openclaw.desktop-pet.plist << EOF
Labelai.openclaw.desktop-pet
ProgramArguments
APPPATH/nodemodules/.bin/electron
APP_PATH
WorkingDirectoryAPP_PATH
RunAtLoad
KeepAlive
StandardOutPath/tmp/desktop-pet.log
StandardErrorPath/tmp/desktop-pet.log
EnvironmentVariables
PATH/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin
EOF
将APP_PATH替换为应用目录的绝对路径。
自定义
宠物通过index.html中的Canvas像素艺术以编程方式绘制。要更改生物:
- - 使用新的像素布局编辑lobsterBase()和lobsterFront()函数
- 颜色在脚本块顶部定义为常量
- 每个像素为{x, y, w, h, color},比例为3倍
功能特性
- - 透明覆盖层,始终置顶,点击穿透(宠物本身除外)
- 在完整桌面上漫游:地板、墙壁、天花板
- 避开光标(250像素半径)和最前窗口
- 右键上下文菜单,用于手动状态控制
- 自动调整大小的对话气泡
- 通过Canvas绘制像素艺术(无需外部图片)