aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarvin Borner2019-06-30 13:51:25 +0200
committerMarvin Borner2019-06-30 13:51:25 +0200
commitfac8d1c0f2ab1292f0ccff642a10571635387269 (patch)
tree9575ba3adc1c1fe792d00e37a73bf951851893e9
parent44551ef34d91e83f2df917b27deeace3eaa324e9 (diff)
Fixed single monitor setup
-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()