Handle starting with turned-off monitors Fix #2

This commit is contained in:
Roberto Alsina 2020-02-02 11:18:01 -03:00
parent b3c03fe723
commit fbe63db894

View File

@ -366,6 +366,10 @@ class Window(QObject):
self.ui.modes.clear() self.ui.modes.clear()
for mode in self.xrandr_info[name]["modes"]: for mode in self.xrandr_info[name]["modes"]:
self.ui.modes.addItem(mode) self.ui.modes.addItem(mode)
if self.xrandr_info[name]["current_mode"] is None: # Happens with turned off monitors
self.xrandr_info[name]['enabled'] = False
h_scale = v_scale = 1
else:
self.ui.modes.setCurrentText(self.xrandr_info[name]["current_mode"]) self.ui.modes.setCurrentText(self.xrandr_info[name]["current_mode"])
mod_x, mod_y = [ mod_x, mod_y = [
int(x) for x in self.xrandr_info[name]["current_mode"].split("x") int(x) for x in self.xrandr_info[name]["current_mode"].split("x")