mirror of
https://github.com/ralsina/xrandroll.git
synced 2024-11-22 11:02:22 +00:00
Handle starting with turned-off monitors Fix #2
This commit is contained in:
parent
b3c03fe723
commit
fbe63db894
@ -366,16 +366,20 @@ 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)
|
||||||
self.ui.modes.setCurrentText(self.xrandr_info[name]["current_mode"])
|
if self.xrandr_info[name]["current_mode"] is None: # Happens with turned off monitors
|
||||||
mod_x, mod_y = [
|
self.xrandr_info[name]['enabled'] = False
|
||||||
int(x) for x in self.xrandr_info[name]["current_mode"].split("x")
|
h_scale = v_scale = 1
|
||||||
]
|
|
||||||
if self.xrandr_info[name]["orientation"] in (0, 2):
|
|
||||||
h_scale = self.xrandr_info[name]["res_x"] / mod_x
|
|
||||||
v_scale = self.xrandr_info[name]["res_y"] / mod_y
|
|
||||||
else:
|
else:
|
||||||
h_scale = self.xrandr_info[name]["res_y"] / mod_x
|
self.ui.modes.setCurrentText(self.xrandr_info[name]["current_mode"])
|
||||||
v_scale = self.xrandr_info[name]["res_x"] / mod_y
|
mod_x, mod_y = [
|
||||||
|
int(x) for x in self.xrandr_info[name]["current_mode"].split("x")
|
||||||
|
]
|
||||||
|
if self.xrandr_info[name]["orientation"] in (0, 2):
|
||||||
|
h_scale = self.xrandr_info[name]["res_x"] / mod_x
|
||||||
|
v_scale = self.xrandr_info[name]["res_y"] / mod_y
|
||||||
|
else:
|
||||||
|
h_scale = self.xrandr_info[name]["res_y"] / mod_x
|
||||||
|
v_scale = self.xrandr_info[name]["res_x"] / mod_y
|
||||||
self.ui.horizontalScale.setValue(h_scale * 1000)
|
self.ui.horizontalScale.setValue(h_scale * 1000)
|
||||||
self.ui.verticalScale.setValue(v_scale * 1000)
|
self.ui.verticalScale.setValue(v_scale * 1000)
|
||||||
self.ui.primary.setChecked(self.xrandr_info[name]["primary"])
|
self.ui.primary.setChecked(self.xrandr_info[name]["primary"])
|
||||||
|
Loading…
Reference in New Issue
Block a user