简体   繁体   English

X11:通过命令行移动现有窗口?

[英]X11: move an existing window via command line?

Given an X client window ID, is there a way to move that window or change its geometry from the command line? 给定一个X客户端窗口ID,有没有办法移动该窗口或从命令行更改其几何?

$ 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. 我认为xdotool会做这个工作。

xdotool lets you programatically (or manually) simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11's XTEST extension and other Xlib functions. xdotool允许您以编程方式(或手动)模拟键盘输入和鼠标活动,移动和调整窗口大小等。它使用X11的XTEST扩展和其他Xlib函数来完成此操作。

Eg 例如

$ xdotool windowfocus 0x1a00ad2

will focus the window with id 0x1a00ad2. 将关注id为0x1a00ad2的窗口。 There's also a windowmove command which is probably the one you're looking for. 还有一个windowmove命令,可能就是你要找的那个。

wmctrl is slighty more advanced. wmctrl稍微高级一点。 It is compatible with EWMH/NetWM X window managers as you can read on their website . 它与EWMH / NetWM X窗口管理器兼容,您可以在他们的网站上阅读。 I don't think you'll need it to be compatible with those though. 我不认为你需要它与那些兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM