| name | xdotool-control |
| description | Mouse and keyboard automation using xdotool. Use when clicking Chrome extension icons, typing into GUI apps, switching browser tabs, automating desktop UI, or running screenshot-verify-click loops without a browser relay. Triggers on: 'click extension icon', 'click coordinates', 'type in window', 'switch tab', 'automate mouse', 'screenshot and click', 'xdotool', 'desktop automation', 'GUI automation without relay'. |
xdotool-control
Automate mouse, keyboard, and window operations on the Linux desktop. Primary use: clicking Chrome extension icons, interacting with GUI apps when browser CDP isn't connected.
Quick Start
xdotool search --name "Google Chrome"
xdotool mousemove 1800 56 click 1
xdotool type "hello world"
scrot /tmp/snap.png
Core Patterns
1. Find + Focus + Click
WIN=$(xdotool search --name "Google Chrome" | head -1)
xdotool windowactivate --sync "$WIN"
sleep 0.3
xdotool mousemove X Y click 1
2. Screenshot → Verify → Click Loop
Use this when you need to click an element but don't know its exact position:
bash ~/.openclaw/workspace/skills/xdotool-control/scripts/snap_verify_click.sh \
"Google Chrome" \
"extension_icon" \
1830 56
Or use the full loop script for unknown positions:
bash ~/.openclaw/workspace/skills/xdotool-control/scripts/find_and_click.sh \
"Google Chrome" \
/tmp/target_icon.png \
10
3. Click Chrome Extension Icon
bash ~/.openclaw/workspace/skills/xdotool-control/scripts/click_extension.sh "OpenClaw"
bash ~/.openclaw/workspace/skills/xdotool-control/scripts/click_extension.sh "Dawn"
This focuses Chrome and clicks the extensions puzzle-piece area, then scans for the named extension.
4. Tab Switching
WIN=$(xdotool search --name "Google Chrome" | head -1)
xdotool windowactivate --sync "$WIN"
xdotool key ctrl+Tab
xdotool key ctrl+2
xdotool key ctrl+3
xdotool key ctrl+t
xdotool key ctrl+l
sleep 0.2
xdotool type "https://example.com"
xdotool key Return
5. Type Into Window
WIN=$(xdotool search --name "Terminal" | head -1)
xdotool windowactivate --sync "$WIN"
sleep 0.2
xdotool type --clearmodifiers "command to type here"
xdotool key Return
6. Approve tmux Prompt (for Clawdy daemon)
SESSION=$(tmux ls | grep claude-session | head -1 | cut -d: -f1)
tmux send-keys -t "$SESSION" "Yes" Enter
Window Management
xdotool search --name "" | while read wid; do
name=$(xdotool getwindowname "$wid" 2>/dev/null)
[ -n "$name" ] && echo "$wid $name"
done | head -20
xdotool getwindowgeometry $WIN_ID
xdotool windowraise $WIN_ID
xdotool windowsize $WIN_ID 1280 800
xdotool windowmove $WIN_ID 0 0
Screenshot Utilities
scrot /tmp/desktop.png
scrot -u /tmp/active_window.png
scrot -a 1400,0,480,60 /tmp/toolbar.png
scrot -d 2 /tmp/delayed.png
Read screenshots with Claude's Read tool — it renders images inline.
Chrome-Specific Patterns
Clicking a Pinned Extension Icon
read SCREEN_W SCREEN_H <<< $(xdotool getdisplaygeometry)
TOOLBAR_Y=56
scrot -a "$((SCREEN_W-300)),0,300,70" /tmp/toolbar_snap.png
xdotool mousemove $((SCREEN_W - 60)) $TOOLBAR_Y click 1
Dependencies
sudo apt-get install xdotool scrot
sudo apt-get install imagemagick
for dep in xdotool scrot convert; do
command -v "$dep" &>/dev/null && echo "✓ $dep" || echo "✗ $dep (missing)"
done
Tips & Gotchas
- Always
windowactivate --sync before clicking — without --sync, the click may fire before focus lands
- Add
sleep 0.3 after focus change before interacting with Chrome
- Coordinates are screen-absolute, not window-relative — factor in window position from
getwindowgeometry
xdotool type vs xdotool key: use type for text strings, key for special keys (ctrl+t, Return, Escape)
--clearmodifiers on type prevents Shift/Ctrl state from leaking into typed text
- scrot -u captures only the currently active window — make sure to activate the right window first
- ImageMagick compare can do pixel-level template matching for verify loops (see
find_and_click.sh)