Skip to content

Instantly share code, notes, and snippets.

@chipolux
Created August 23, 2017 00:08
Show Gist options
  • Save chipolux/13963019c6ca4a2fed348a36c17e1277 to your computer and use it in GitHub Desktop.
Save chipolux/13963019c6ca4a2fed348a36c17e1277 to your computer and use it in GitHub Desktop.
Moving X11 Window (python-xlib)
import Xlib.display
WINDOW_NAME = 'some window name'
d = Xlib.display.Display()
r = d.screen().root
x = 0
y = 100
width = r.get_geometry().width
height = r.get_geometry().height - y
window_ids = r.get_full_property(
d.intern_atom('_NET_CLIENT_LIST'), Xlib.X.AnyPropertyType
).value
for window_id in window_ids:
window = d.create_resource_object('window', window_id)
if window.get_wm_name() == WINDOW_NAME:
print('Moving Window')
window.configure(
x=x,
y=y,
width=width,
height=height,
border_width=0,
stack_mode=Xlib.X.Above
)
d.sync()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment