diff --git a/xrandroll/main.py b/xrandroll/main.py index 0aedfda..3c19b20 100644 --- a/xrandroll/main.py +++ b/xrandroll/main.py @@ -250,9 +250,26 @@ class Window(QObject): # mon_item.setPos(monitor["pos_x"], monitor["pos_y"]) self.scene.addItem(mon_item) monitor["item"] = mon_item + self.ui.screenCombo.setCurrentText(self.choose_a_monitor()) self.adjust_view() 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): mon = self.ui.screenCombo.currentText() orientation = self.ui.orientationCombo.currentIndex()