mirror of
https://github.com/ralsina/xrandroll.git
synced 2024-11-21 18:42:22 +00:00
Choose a reasonable monitor as initially selected one
This commit is contained in:
parent
b5d1492373
commit
c220bdcd74
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user