Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I move/resize a window using python-xlib?

Tags:

python

xlib

How can I resize/move a window using python-xlib? I have the X window ID. What's the equivalent python-xlib snippet to wmctrl -i -r $id -e $gravity,$x,$y,$width,$height?

like image 717
Daenyth Avatar asked Jun 20 '12 19:06

Daenyth


1 Answers

You need ConfigureWindow request to change x,y,width,height and ChangeWindowAttributes request to change gravity. You can use them directly or with resource/window wrapper

win = xobject.drawable.Window(display, id)
win.configure(x=123, y=345, width=678, height=910)
win.change_attributes(win_gravity=X.NorthWestGravity, bit_gravity=X.StaticGravity)
like image 61
Andrey Sidorov Avatar answered Sep 22 '22 05:09

Andrey Sidorov