From 984d11595b1c505d247677db07342fd910780f2b Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Sun, 11 Apr 2021 18:25:53 -0400 Subject: [PATCH] remove Xlib dependency; it's kind of unneccesary -- we will default to 1 monitor if xrandr fails to shell out anyways --- nitroplasm.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/nitroplasm.py b/nitroplasm.py index aed2ce1..c0b24aa 100755 --- a/nitroplasm.py +++ b/nitroplasm.py @@ -21,7 +21,6 @@ from PyQt5.QtWidgets import \ QSizePolicy import sys from PyQt5.QtGui import QPixmap -from Xlib import display import subprocess import dbus import argparse @@ -105,15 +104,13 @@ class Window(QWidget): self.layout = self.layout_selector.itemData(index) def get_displays(self): - if 'RANDR' in display.Display().list_extensions(): - try: - output = [l for l in subprocess.check_output(["xrandr"]).decode("utf-8").splitlines()] - return len([l.split()[0] for l in output if " connected " in l]) - except: - return 1 - else: + try: + output = [l for l in subprocess.check_output(["xrandr"]).decode("utf-8").splitlines()] + return len([l.split()[0] for l in output if " connected " in l]) + except: return 1 + def set_monitor(self, index): self.monitor = self.monitor_selector.itemData(index)