问题描述
给定一个 X 客户端窗口 ID,有没有办法从命令行移动该窗口或更改其几何形状?
$ xlsclients -a窗口 0x3000001:机器:欧姆名称: 终端图标名称:foo命令:foo实例/类:foo/bar$ xmovewindow -id 0x3000001 --geometry +100+200 <-- 这就是我想做的
我认为 xdotool会做的工作.
xdotool 允许您以编程方式(或手动)模拟键盘输入和鼠标活动、移动和调整窗口大小等.它使用 X11 的 XTEST 扩展和其他 Xlib 功能来实现.
例如
$ xdotool windowfocus 0x1a00ad2
将聚焦 id 为 0x1a00ad2 的窗口.还有一个 windowmove 命令,它可能正是您要找的.p>
wmctrl 稍微高级一些.它与 EWMH/NetWM X 窗口管理器兼容,您可以在 他们的网站 上阅读.不过,我认为您不需要它来与那些兼容.
Given an X client window ID, is there a way to move that window or change its geometry from the command line?
$ xlsclients -a
Window 0x3000001:
Machine: ohm
Name: Terminal
Icon Name: foo
Command: foo
Instance/Class: foo/bar
$ xmovewindow -id 0x3000001 --geometry +100+200 <-- this is what I would like to do
I think xdotool will do the job.
E.g.
$ xdotool windowfocus 0x1a00ad2
will focus the window with id 0x1a00ad2. There's also a windowmove command which is probably the one you're looking for.
wmctrl is slighty more advanced. It is compatible with EWMH/NetWM X window managers as you can read on their website. I don't think you'll need it to be compatible with those though.
这篇关于X11:通过命令行移动现有窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!