fix: skip unsupported commands on Wayland

This commit is contained in:
Alfredo Monclus committed 2026-01-27 10:23:45 -03:00
1 parent cb9f266a76
commit 92b56f039b
3 files changed
+20 -8

No files matched your search

+4 -2
View File
@@ -286,8 +286,10 @@ class KlippyGtk:
if show:
window.set_cursor(
Gdk.Cursor.new_for_display(Gdk.Display.get_default(), Gdk.CursorType.ARROW))
os.system("xsetroot -cursor_name arrow")
if not self.screen.wayland:
os.system("xsetroot -cursor_name arrow")
else:
window.set_cursor(
Gdk.Cursor.new_for_display(Gdk.Display.get_default(), Gdk.CursorType.BLANK_CURSOR))
os.system("xsetroot -cursor ks_includes/emptyCursor.xbm ks_includes/emptyCursor.xbm")
if not self.screen.wayland:
os.system("xsetroot -cursor ks_includes/emptyCursor.xbm ks_includes/emptyCursor.xbm")
+2
View File
@@ -27,6 +27,8 @@ class Panel(ScreenPanel):
self.labels['settings_menu'].add(self.labels['settings'])
for option in options:
name = list(option)[0]
if name == "use_dpms" and screen.wayland:
continue
self.add_option('settings', self.settings, name, option[name])
self.labels['lang_menu'] = self._gtk.ScrolledWindow()
+14 -6
View File
@@ -90,7 +90,6 @@ class KlipperScreen(Gtk.Window):
raise RuntimeError from e
GLib.set_prgname('KlipperScreen')
self.blanking_time = 600
self.use_dpms = True
self.apiclient = None
self.dialogs = []
self.confirm = None
@@ -177,7 +176,7 @@ class KlipperScreen(Gtk.Window):
self.show_error_modal("Invalid config file", self._config.get_errors())
return
self.base_panel.activate()
self.use_dpms = self._config.get_main_config().getboolean("use_dpms", fallback=True)
self.use_dpms = self._config.get_main_config().getboolean("use_dpms", fallback=(not self.wayland))
self.use_dpms &= functions.dpms_loaded
self.set_dpms(self.use_dpms)
self.lock_screen = LockScreen(self)
@@ -633,6 +632,8 @@ class KlipperScreen(Gtk.Window):
return True
def wake_screen(self):
if self.wayland:
return
# Wake the screen (it will go to standby as configured)
if not self.use_dpms:
logging.debug("DPMS is disabled cannot wake the screen")
@@ -650,6 +651,12 @@ class KlipperScreen(Gtk.Window):
return
def set_dpms(self, use_dpms):
if self.wayland:
self.use_dpms = False
self._config.set("main", "use_dpms", False)
self._config.save_user_config_options()
logging.debug("DPMS handling not supported on Wayland")
return
if not use_dpms:
if self.check_dpms_timeout is not None:
GLib.source_remove(self.check_dpms_timeout)
@@ -697,8 +704,9 @@ class KlipperScreen(Gtk.Window):
def set_screenblanking_timeout(self, time):
# disable screensaver we have our own
os.system(f"xset -display {self.display_number} s off")
os.system(f"xset -display {self.display_number} s noblank")
if not self.wayland:
os.system(f"xset -display {self.display_number} s off")
os.system(f"xset -display {self.display_number} s noblank")
if time == "off":
self.blanking_time = 0
else:
@@ -706,11 +714,11 @@ class KlipperScreen(Gtk.Window):
self.blanking_time = abs(int(time))
except Exception as exc:
logging.exception(exc)
if self.use_dpms:
if self.use_dpms and not self.wayland:
self.set_dpms_timeout()
else:
self.screensaver.reset_timeout()
logging.debug(f"Blanking timeout: {time} DPMS:{self.use_dpms}")
logging.debug(f"Blanking timeout: {time}")
def show_printer_select(self, widget=None):
self.base_panel.show_heaters(False)