| name | xdotool |
| description | Linux UI automation using xdotool for window management, keyboard/mouse simulation, and desktop control. |
| metadata | {"xiaodazi":{"dependency_level":"external","os":["linux"],"backend_type":"local","user_facing":true,"bins":["xdotool"]}} |
Linux UI 自动化
使用 xdotool 控制 Linux 桌面窗口和输入。
安装
sudo apt install xdotool
sudo dnf install xdotool
sudo pacman -S xdotool
命令参考
窗口管理
xdotool getactivewindow getwindowname
xdotool search --name "Firefox"
xdotool windowactivate $(xdotool search --name "Firefox" | head -1)
xdotool windowminimize $(xdotool getactivewindow)
xdotool windowmove --sync $(xdotool getactivewindow) 100 100
xdotool windowsize --sync $(xdotool getactivewindow) 1200 800
键盘输入
xdotool type "Hello World"
xdotool key Return
xdotool key ctrl+c
xdotool key ctrl+shift+t
xdotool key super
鼠标操作
xdotool mousemove 500 300
xdotool click 1
xdotool click 3
xdotool mousemove 500 300 click 1
等待
xdotool search --sync --name "Save"
注意
- 仅支持 X11,Wayland 下需要用
ydotool 替代
- 某些应用可能不响应 xdotool 的键盘输入