desktop-control
Advanced desktop automation with mouse, keyboard, and screen control
What this skill does
# Desktop Control Skill
**The most advanced desktop automation skill for OpenClaw.** Provides pixel-perfect mouse control, lightning-fast keyboard input, screen capture, window management, and clipboard operations.
## ๐ฏ Features
### Mouse Control
- โ
**Absolute positioning** - Move to exact coordinates
- โ
**Relative movement** - Move from current position
- โ
**Smooth movement** - Natural, human-like mouse paths
- โ
**Click types** - Left, right, middle, double, triple clicks
- โ
**Drag & drop** - Drag from point A to point B
- โ
**Scroll** - Vertical and horizontal scrolling
- โ
**Position tracking** - Get current mouse coordinates
### Keyboard Control
- โ
**Text typing** - Fast, accurate text input
- โ
**Hotkeys** - Execute keyboard shortcuts (Ctrl+C, Win+R, etc.)
- โ
**Special keys** - Enter, Tab, Escape, Arrow keys, F-keys
- โ
**Key combinations** - Multi-key press combinations
- โ
**Hold & release** - Manual key state control
- โ
**Typing speed** - Configurable WPM (instant to human-like)
### Screen Operations
- โ
**Screenshot** - Capture entire screen or regions
- โ
**Image recognition** - Find elements on screen (via OpenCV)
- โ
**Color detection** - Get pixel colors at coordinates
- โ
**Multi-monitor** - Support for multiple displays
### Window Management
- โ
**Window list** - Get all open windows
- โ
**Activate window** - Bring window to front
- โ
**Window info** - Get position, size, title
- โ
**Minimize/Maximize** - Control window states
### Safety Features
- โ
**Failsafe** - Move mouse to corner to abort
- โ
**Pause control** - Emergency stop mechanism
- โ
**Approval mode** - Require confirmation for actions
- โ
**Bounds checking** - Prevent out-of-screen operations
- โ
**Logging** - Track all automation actions
---
## ๐ Quick Start
### Installation
First, install required dependencies:
```bash
pip install pyautogui pillow opencv-python pygetwindow
```
### Basic Usage
```python
from skills.desktop_control import DesktopController
# Initialize controller
dc = DesktopController(failsafe=True)
# Mouse operations
dc.move_mouse(500, 300) # Move to coordinates
dc.click() # Left click at current position
dc.click(100, 200, button="right") # Right click at position
# Keyboard operations
dc.type_text("Hello from OpenClaw!")
dc.hotkey("ctrl", "c") # Copy
dc.press("enter")
# Screen operations
screenshot = dc.screenshot()
position = dc.get_mouse_position()
```
---
## ๐ Complete API Reference
### Mouse Functions
#### `move_mouse(x, y, duration=0, smooth=True)`
Move mouse to absolute screen coordinates.
**Parameters:**
- `x` (int): X coordinate (pixels from left)
- `y` (int): Y coordinate (pixels from top)
- `duration` (float): Movement time in seconds (0 = instant, 0.5 = smooth)
- `smooth` (bool): Use bezier curve for natural movement
**Example:**
```python
# Instant movement
dc.move_mouse(1000, 500)
# Smooth 1-second movement
dc.move_mouse(1000, 500, duration=1.0)
```
#### `move_relative(x_offset, y_offset, duration=0)`
Move mouse relative to current position.
**Parameters:**
- `x_offset` (int): Pixels to move horizontally (positive = right)
- `y_offset` (int): Pixels to move vertically (positive = down)
- `duration` (float): Movement time in seconds
**Example:**
```python
# Move 100px right, 50px down
dc.move_relative(100, 50, duration=0.3)
```
#### `click(x=None, y=None, button='left', clicks=1, interval=0.1)`
Perform mouse click.
**Parameters:**
- `x, y` (int, optional): Coordinates to click (None = current position)
- `button` (str): 'left', 'right', 'middle'
- `clicks` (int): Number of clicks (1 = single, 2 = double)
- `interval` (float): Delay between multiple clicks
**Example:**
```python
# Simple left click
dc.click()
# Double-click at specific position
dc.click(500, 300, clicks=2)
# Right-click
dc.click(button='right')
```
#### `drag(start_x, start_y, end_x, end_y, duration=0.5, button='left')`
Drag and drop operation.
**Parameters:**
- `start_x, start_y` (int): Starting coordinates
- `end_x, end_y` (int): Ending coordinates
- `duration` (float): Drag duration
- `button` (str): Mouse button to use
**Example:**
```python
# Drag file from desktop to folder
dc.drag(100, 100, 500, 500, duration=1.0)
```
#### `scroll(clicks, direction='vertical', x=None, y=None)`
Scroll mouse wheel.
**Parameters:**
- `clicks` (int): Scroll amount (positive = up/left, negative = down/right)
- `direction` (str): 'vertical' or 'horizontal'
- `x, y` (int, optional): Position to scroll at
**Example:**
```python
# Scroll down 5 clicks
dc.scroll(-5)
# Scroll up 10 clicks
dc.scroll(10)
# Horizontal scroll
dc.scroll(5, direction='horizontal')
```
#### `get_mouse_position()`
Get current mouse coordinates.
**Returns:** `(x, y)` tuple
**Example:**
```python
x, y = dc.get_mouse_position()
print(f"Mouse is at: {x}, {y}")
```
---
### Keyboard Functions
#### `type_text(text, interval=0, wpm=None)`
Type text with configurable speed.
**Parameters:**
- `text` (str): Text to type
- `interval` (float): Delay between keystrokes (0 = instant)
- `wpm` (int, optional): Words per minute (overrides interval)
**Example:**
```python
# Instant typing
dc.type_text("Hello World")
# Human-like typing at 60 WPM
dc.type_text("Hello World", wpm=60)
# Slow typing with 0.1s between keys
dc.type_text("Hello World", interval=0.1)
```
#### `press(key, presses=1, interval=0.1)`
Press and release a key.
**Parameters:**
- `key` (str): Key name (see Key Names section)
- `presses` (int): Number of times to press
- `interval` (float): Delay between presses
**Example:**
```python
# Press Enter
dc.press('enter')
# Press Space 3 times
dc.press('space', presses=3)
# Press Down arrow
dc.press('down')
```
#### `hotkey(*keys, interval=0.05)`
Execute keyboard shortcut.
**Parameters:**
- `*keys` (str): Keys to press together
- `interval` (float): Delay between key presses
**Example:**
```python
# Copy (Ctrl+C)
dc.hotkey('ctrl', 'c')
# Paste (Ctrl+V)
dc.hotkey('ctrl', 'v')
# Open Run dialog (Win+R)
dc.hotkey('win', 'r')
# Save (Ctrl+S)
dc.hotkey('ctrl', 's')
# Select All (Ctrl+A)
dc.hotkey('ctrl', 'a')
```
#### `key_down(key)` / `key_up(key)`
Manually control key state.
**Example:**
```python
# Hold Shift
dc.key_down('shift')
dc.type_text("hello") # Types "HELLO"
dc.key_up('shift')
# Hold Ctrl and click (for multi-select)
dc.key_down('ctrl')
dc.click(100, 100)
dc.click(200, 100)
dc.key_up('ctrl')
```
---
### Screen Functions
#### `screenshot(region=None, filename=None)`
Capture screen or region.
**Parameters:**
- `region` (tuple, optional): (left, top, width, height) for partial capture
- `filename` (str, optional): Path to save image
**Returns:** PIL Image object
**Example:**
```python
# Full screen
img = dc.screenshot()
# Save to file
dc.screenshot(filename="screenshot.png")
# Capture specific region
img = dc.screenshot(region=(100, 100, 500, 300))
```
#### `get_pixel_color(x, y)`
Get color of pixel at coordinates.
**Returns:** RGB tuple `(r, g, b)`
**Example:**
```python
r, g, b = dc.get_pixel_color(500, 300)
print(f"Color at (500, 300): RGB({r}, {g}, {b})")
```
#### `find_on_screen(image_path, confidence=0.8)`
Find image on screen (requires OpenCV).
**Parameters:**
- `image_path` (str): Path to template image
- `confidence` (float): Match threshold (0-1)
**Returns:** `(x, y, width, height)` or None
**Example:**
```python
# Find button on screen
location = dc.find_on_screen("button.png")
if location:
x, y, w, h = location
# Click center of found image
dc.click(x + w//2, y + h//2)
```
#### `get_screen_size()`
Get screen resolution.
**Returns:** `(width, height)` tuple
**Example:**
```pytRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.