Linux command
xte 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Simulate key press
xte 'key [Return]'
Type a string
xte 'str [Hello World]'
Click left mouse button
xte 'mouseclick 1'
Move mouse to absolute position
xte 'mousemove [100] [200]'
Move mouse relative
xte 'mousermove [10] [-5]'
Simulate Ctrl+C
xte 'keydown Control_L' 'key c' 'keyup Control_L'
Sleep between actions
xte 'mousemove 100 100' 'sleep 1' 'mouseclick 1'
说明
xte generates fake keyboard and mouse input using the XTest X11 extension. It's part of the xautomation package and enables automation of GUI interactions from scripts. Commands can be chained in a single invocation or across multiple calls. Key names follow X11 keysym naming conventions. Mouse buttons are numbered: 1 (left), 2 (middle), 3 (right), 4/5 (scroll). Common uses include GUI testing, automating repetitive tasks, and creating macros. Often combined with xbindkeys for keyboard shortcuts.
参数
- -x _display_
- Send commands to specified display.
- -i _id_
- Use specific XInput device.
FAQ
What is the xte command used for?
xte generates fake keyboard and mouse input using the XTest X11 extension. It's part of the xautomation package and enables automation of GUI interactions from scripts. Commands can be chained in a single invocation or across multiple calls. Key names follow X11 keysym naming conventions. Mouse buttons are numbered: 1 (left), 2 (middle), 3 (right), 4/5 (scroll). Common uses include GUI testing, automating repetitive tasks, and creating macros. Often combined with xbindkeys for keyboard shortcuts.
How do I run a basic xte example?
Run `xte 'key [Return]'` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -x _display_ do in xte?
Send commands to specified display.