~ubuntu-branches/debian/wheezy/gtg/wheezy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Description: Check if a display is available instead of relying on xset
Origin: http://bazaar.launchpad.net/~gtg/gtg/trunk/revision/877

Index: gtg-0.2.4/gtg
===================================================================
--- gtg-0.2.4.orig/gtg	2010-09-05 02:08:29.896400600 +0200
+++ gtg-0.2.4/gtg	2010-09-05 11:44:11.639955308 +0200
@@ -32,10 +32,13 @@
 from optparse import OptionParser
 
 def X_is_running():
-    from subprocess import Popen, PIPE
-    p = Popen(["xset", "-q"], stdout=PIPE, stderr=PIPE)
-    p.communicate()
-    return p.returncode == 0
+    from gtk.gdk import Screen
+    try:
+        if Screen().get_display():
+            return True
+    except RuntimeError:
+        pass
+    return False
 
 try:
     parser = OptionParser()