Created
April 10, 2012 16:49
-
-
Save sahib/2352808 to your computer and use it in GitHub Desktop.
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/python | |
def find_next_free_x_display(): | |
for i in range(10): | |
try_path = "/tmp/.X" + str(i) + "-lock" | |
try: | |
with open(try_path,"r"): | |
print("-- " + str(i) + " is there") | |
except: | |
return i | |
else: | |
return -1 | |
print(find_next_free_x_display()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment