源代码最近一次更新是 Oct 26, 2019

xdotool 命令用法

命令 用法 解释 实例
getactivewindow xdotool getactivewindow 获取当前活动窗口的ID
getwindowfocus xdotool getwindowfocus 获取当前窗口的ID
getwindowname xdotool [window] getwindowname 获取指定窗口的名称
getwindowpid xdotool [window] getwindowpid 获取指定窗口的pid
getwindowgeometry xdotool [options] [window] getwindowgeometry 输出窗口的几何形状。值包括:x,y,宽度,高度和屏幕编号。
search xdotool search [options] pattern 搜索带有标题,名称或带有正则表达式模式的类的窗口。输出是X窗口标识符的行分隔列表。 xdotool search —onlyvisible —name [firefox]:检索正在运行的Firefox窗口ID
selectwindow 通过单击获取窗口ID
help xdotool help 查看帮助
version xdotool version 查看版本
behave xdotool window action command 将动作绑定到窗口上的事件。这样,只要发生匹配的事件,您就可以运行其他xdotool命令。
behave_screen_edge xdotool [options] where command… 当鼠标击中屏幕边缘或边缘时,将动作绑定到事件。 xdotool behave_screen_edge bottom-left \
search —class google-chrome windowactivate
click xdotool click [1|2|3|4|5] 鼠标单击左键,中键,右键,向上滚轮,向下滚轮
getmouselocation xdotool getmouselocation 输出鼠标光标的x,y,屏幕和窗口ID。如果您有多台显示器并且未使用Xinerama,则屏幕号将为非零。
key xdotool key [options] keystroke [keystroke…] 模拟按键
keydown xdotool [options] keystroke 按下
keyup xdotool keystroke 抬起
mousedown xdotool [options] button 鼠标按下
mousemove xdotool mousemove [options] x y OR ‘restore’ 移动鼠标到x,y坐标,或者恢复到上一个位置
mousemove_relative xdotool mousemove_relative [options] x y 移动到相对于当前坐标的x,y坐标
mouseup xdotool [options] button 鼠标松开
set_window xdotool set_window [options] [window_id=%1] 设置有关窗口属性
type xdotool type [options] something to type 键入一条消息
windowfocus xdotool windowfocus [options] [window] 将焦点放在指定id的窗口上 xdotool windowfocus —sync [12345]
windowkill xdotool windowkill [window] 杀死一个窗口
windowclose xdotool windowclose [window] 关闭一个窗口
windowmap xdotool windowmap [options] [window] 映射窗口
windowminimize xdotool windowminimize [options] [window] 最小化窗口
windowmove xdotool [options] [window] windowmove x y 将窗口移到给定位置。如果没有给出窗口,则默认为%1
windowraise xdotool windowraise [window_id=%1] 置顶窗口(提升到堆栈顶部),默认当前窗口
windowreparent xdotool windowreparent [source_window] destination_window 将source_window移到destination_window的子窗口
windowsize xdotool [options] windowsize [window] width height 设置给定窗口的窗口大小。如果没有给出窗口,则默认为%1
windowunmap xdotool windowunmap [options] [window_id=%1] 取消映射窗口
set_num_desktops xdotool set_num_desktops [number] 更改桌面或工作区的数量
get_num_desktops xdotool get_num_desktops 获取当前 桌面或工作区数量
set_desktop xdotool set_desktop [options] desktop_number 将当前视图更改为指定的桌面
get_desktop xdotool get_desktop 在视图中输出当前桌面
set_desktop_for_window xdotool set_desktop_for_window [window] desktop_number 将窗口移到其他桌面
get_desktop_for_window xdotool get_desktop_for_window [window] 输出当前包含给定窗口的桌面。将窗口移到其他桌面。
get_desktop_viewport xdotool get_desktop_viewport 获取当前窗口位置
set_desktop_viewport xdotool set_desktop_viewport 将视口移动到给定位置。
exec xdotool exec [options] 执行一个程序。当与behavior_screen_edge结合使用以进行诸如锁定屏幕之类的操作时,这通常很有用。 xdotool behave_screen_edge —delay 1000 top-right
exec gnome-screensaver-command —lock
sleep xdotool sleep number 休眠一段时间

参考资料