Repository: lutris/lutris

Issue:
Restore monitor refresh rate
My monitor's default refresh rate is 60Hz, but I set it to 72Hz. When game exits, lutris does not restore monitor refresh rate to 72Hz. Is this feature available? If not can it be added?


Discussion:
Does it happen with all games? What games are you trying to run? Wine Steam, Linux Steam...?
@duhow 
Yes, with all games. Wine steam, linux steam and non steam wine games have been tried and faced with this problem. I don't know if this is relevant, the screen resolution is updated even for games whose resolution update settings have been disabled. Also, they are updating for situation when the resolution after game exit is alright and does not need any change. I am using lutris version 0.4.18.1.
In `Lutris > System preferences` did you made any changes for Resolution / Xephyr settings?
I unchecked resolution and gamma options. I don't understand what xephyr is, so i left it as it is.

Resolving patch:
diff --git a/lutris/util/display.py b/lutris/util/display.py
--- a/lutris/util/display.py
+++ b/lutris/util/display.py
@@ -34,6 +34,11 @@ def get_outputs():
     """Return list of tuples containing output name and geometry."""
     outputs = []
     vid_modes = get_vidmodes()
+    display=None
+    mode=None
+    position=None
+    rotate=None
+    refresh_rate=None
     if not vid_modes:
         logger.error("xrandr didn't return anything")
         return []
@@ -53,16 +58,18 @@ def get_outputs():
             if geom.startswith('('):  # Screen turned off, no geometry
                 continue
             if rotate.startswith('('):  # Screen not rotated, no need to include
-                outputs.append((parts[0], geom, "normal"))
-            else:
-                if rotate in ("left", "right"):
-                    geom_parts = geom.split('+')
-                    x_y = geom_parts[0].split('x')
-                    geom = "{}x{}+{}+{}".format(x_y[1], x_y[0], geom_parts[1], geom_parts[2])
-                outputs.append((parts[0], geom, rotate))
+                rotate="normal"
+            geo_split=geom.split('+')
+            position=geo_split[1] + "x" + geo_split[2]
+            display=parts[0]
+        elif '*' in line:
+            mode=parts[0]
+            for number in parts:
+                if '*' in number:
+                    refresh_rate=number[:5]
+                    outputs.append((display, mode, position, rotate, refresh_rate))
     return outputs
 
-
 def get_output_names():
     return [output[0] for output in get_outputs()]
 
@@ -123,24 +130,25 @@ def change_resolution(resolution):
         for display in resolution:
             display_name = display[0]
             logger.debug("Switching to %s on %s", display[1], display[0])
-            display_geom = display[1].split('+')
-            display_resolution = display_geom[0]
-            position = (display_geom[1], display_geom[2])
+            display_mode=display[1]
+            position=display[2]
+            refresh_rate=display[4]
 
             if (
                 len(display) > 2 and
-                display[2] in ('normal', 'left', 'right', 'inverted')
+                display[3] in ('normal', 'left', 'right', 'inverted')
             ):
-                rotation = display[2]
+                rotation = display[3]
             else:
                 rotation = "normal"
 
             subprocess.Popen([
                 "xrandr",
                 "--output", display_name,
-                "--mode", display_resolution,
-                "--pos", "{}x{}".format(position[0], position[1]),
-                "--rotate", rotation
+                "--mode", display_mode,
+                "--pos", position,
+                "--rotate", rotation,
+                "--rate", refresh_rate
             ]).communicate()
 
 


Test patch: