Choose a reasonable monitor as initially selected one

This commit is contained in:
Roberto Alsina 2020-02-03 10:44:13 -03:00
parent b5d1492373
commit c220bdcd74

View File

@ -250,9 +250,26 @@ class Window(QObject):
# mon_item.setPos(monitor["pos_x"], monitor["pos_y"]) # mon_item.setPos(monitor["pos_x"], monitor["pos_y"])
self.scene.addItem(mon_item) self.scene.addItem(mon_item)
monitor["item"] = mon_item monitor["item"] = mon_item
self.ui.screenCombo.setCurrentText(self.choose_a_monitor())
self.adjust_view() self.adjust_view()
self.scale_changed() # Trigger scale labels update self.scale_changed() # Trigger scale labels update
def choose_a_monitor(self):
"""Choose what monitor to select by default.
* Not disabled
* Primary, if possible
"""
candidate = None
for name, mon in self.xrandr_info.items():
if not mon['enabled']:
continue
if mon['primary']:
return name
candidate = name
return candidate
def orientation_changed(self): def orientation_changed(self):
mon = self.ui.screenCombo.currentText() mon = self.ui.screenCombo.currentText()
orientation = self.ui.orientationCombo.currentIndex() orientation = self.ui.orientationCombo.currentIndex()