Skip to content

Commit

Permalink
Prevent the state doesn't be changed issue with NV driver
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhsuan committed Jan 13, 2025
1 parent 209cc36 commit 810d44b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion checkbox-support/checkbox_support/dbus/gnome_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,13 @@ def cycle(
# left and right should convert x and y
xy = 1 if (trans == 1 or trans == 3) else 0
position_x += int(m.resolution.split("x")[xy])
self._apply_monitors_config(state[0], logical_monitors)
try:
self._apply_monitors_config(state[0], logical_monitors)
except GLib.Error:

Check warning on line 180 in checkbox-support/checkbox_support/dbus/gnome_monitor.py

View check run for this annotation

Codecov / codecov/patch

checkbox-support/checkbox_support/dbus/gnome_monitor.py#L180

Added line #L180 was not covered by tests
# Sometimes the NVIDIA driver won't change the state.
# Get the state again to prevent this issue.
state = self._get_current_state()
self._apply_monitors_config(state[0], logical_monitors)

Check warning on line 184 in checkbox-support/checkbox_support/dbus/gnome_monitor.py

View check run for this annotation

Codecov / codecov/patch

checkbox-support/checkbox_support/dbus/gnome_monitor.py#L183-L184

Added lines #L183 - L184 were not covered by tests
if action:
action(uni_string, **kwargs)
if not resolution:
Expand Down

0 comments on commit 810d44b

Please sign in to comment.