aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--freedowm.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/freedowm.py b/freedowm.py
index 6323faf..2003cb0 100644
--- a/freedowm.py
+++ b/freedowm.py
@@ -100,12 +100,13 @@ class FreedoWM(object):
"""
window = self.root.create_window(0, 0, 1, 1, 1, self.screen.root_depth)
res = randr.get_screen_resources(window).outputs
- self.monitor_count = len(res)
- for i in range(self.monitor_count):
+ for i in range(len(res)):
info = randr.get_output_info(window, res[i], 0)
- crtc_info = randr.get_crtc_info(window, info.crtc, 0)
- self.monitors.append({"width": crtc_info.width, "height": crtc_info.height})
+ if info.crtc != 0: # Is connected
+ crtc_info = randr.get_crtc_info(window, info.crtc, 0)
+ self.monitors.append({"width": crtc_info.width, "height": crtc_info.height})
+ self.monitor_count = len(self.monitors)
self.log(self.monitors)
window.destroy()