简体   繁体   中英

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?

$ 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 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.

Eg

$ 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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