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
|
QSizePolicy
|
||||||
import sys
|
import sys
|
||||||
from PyQt5.QtGui import QPixmap
|
from PyQt5.QtGui import QPixmap
|
||||||
from Xlib import display
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import dbus
|
import dbus
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -105,15 +104,13 @@ class Window(QWidget):
|
||||||
self.layout = self.layout_selector.itemData(index)
|
self.layout = self.layout_selector.itemData(index)
|
||||||
|
|
||||||
def get_displays(self):
|
def get_displays(self):
|
||||||
if 'RANDR' in display.Display().list_extensions():
|
try:
|
||||||
try:
|
output = [l for l in subprocess.check_output(["xrandr"]).decode("utf-8").splitlines()]
|
||||||
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])
|
||||||
return len([l.split()[0] for l in output if " connected " in l])
|
except:
|
||||||
except:
|
|
||||||
return 1
|
|
||||||
else:
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def set_monitor(self, index):
|
def set_monitor(self, index):
|
||||||
self.monitor = self.monitor_selector.itemData(index)
|
self.monitor = self.monitor_selector.itemData(index)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue