remove Xlib dependency; it's kind of unneccesary -- we will default to 1 monitor if xrandr fails to shell out anyways
This commit is contained in:
parent
a859dcd3e8
commit
984d11595b
1 changed files with 5 additions and 8 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue