Skip to content

Commit cdedcfb

Browse files
committed
Don't die if X isn't running.
1 parent 6f93ed4 commit cdedcfb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

xpybutil/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import xcb, xcb.xproto
2-
conn = xcb.connect()
3-
root = conn.get_setup().roots[0].root
2+
3+
try:
4+
conn = xcb.connect()
5+
root = conn.get_setup().roots[0].root
6+
except xcb.ConnectException:
7+
conn = None
8+
root = None
49

0 commit comments

Comments
 (0)