Created
July 13, 2011 14:05
-
-
Save sbz/1080348 to your computer and use it in GitHub Desktop.
create a unix socket on X11 display in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time | |
import socket | |
_PATH_UNIX_X = "/tmp/.X11-unix/X%d" | |
DISPLAY_PORT = 0 | |
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) | |
s.connect(_PATH_UNIX_X % DISPLAY_PORT) | |
time.sleep(10) | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python version of xsock.c [1]
[1] https://gist.github.com/1080330