Fix mode application

This commit is contained in:
Roberto Alsina 2022-06-08 12:57:59 -03:00
parent dce8545ed3
commit 008605b983
3 changed files with 6 additions and 2 deletions

View File

@ -285,7 +285,7 @@ class Window(QObject):
# Show modes
self.ui.modes.clear()
monitor = self.screen.monitors[name]
for name, mode in monitor.modes.items():
for _, mode in monitor.modes.items():
self.ui.modes.addItem(str(mode))
mode = monitor.get_current_mode()

View File

@ -121,7 +121,10 @@ class Monitor:
return None
def get_current_mode(self):
return self.modes[self.get_current_mode_name()]
for k, v in self.modes.items():
if v.current:
return v
return None
def set_current_mode(self, mode_name):
for k, v in self.modes.items():

View File

@ -41,6 +41,7 @@ class Screen:
mode = mon.get_current_mode()
cli.append(f"--pos {int(mon.pos_x)}x{int(mon.pos_y)}")
cli.append(f"--mode {mode.res_x}x{mode.res_y}")
cli.append(f"--rate {mode.frequency}")
mod_x, mod_y = mode.res_x, mode.res_y
if mon.orientation in ("left", "right"):
mod_x, mod_y = mod_y, mod_x