fix: screen not staying off (#1506)

When the screensaver is active and the screen is turned off due to DPMS
the unconditional call to self.screensaver.show wakes the screen up
again.
The check whether the screensaver is already active got lost in the
refactor.

Fixes #1504
This commit is contained in:
Axel Pirek authored and GitHub committed 2024-11-17 12:04:13 -03:00
1 parent 43ad9fc6ae
commit c79ba16ff7
2 files changed
+5 -1

No files matched your search

+3
View File
@@ -13,6 +13,9 @@ class ScreenSaver:
self.screensaver_timeout = None
self.blackbox = None
def is_showing(self):
return self.blackbox is not None
def reset_timeout(self, *args):
if self.screensaver_timeout is not None:
GLib.source_remove(self.screensaver_timeout)
+2 -1
View File
@@ -619,7 +619,8 @@ class KlipperScreen(Gtk.Window):
self.set_dpms(False)
return False
elif state != functions.DPMS_State.On:
self.screensaver.show()
if not self.screensaver.is_showing():
self.screensaver.show()
return True
def wake_screen(self):