Fix fullscreen issue when setting width or height in config for non-desktop machines (#1177)

* Fix fullscreen issue when setting width or height in config for non-desktop machines

Setting width and height in the config should result in a windowed screen, but it is only the case for desktop users.
Fixes https://github.com/KlipperScreen/KlipperScreen/issues/1176 introduced via 8f07f21

* add warnings

---------

Co-authored-by: alfrix <alfredomonclus@gmail.com>
This commit is contained in:
Michael Jäger 2023-11-18 21:04:19 +01:00 committed by GitHub
parent 225f96100a
commit 48095f857c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,10 +127,13 @@ class KlipperScreen(Gtk.Window):
self.width = self._config.get_main_config().getint("width", None)
self.height = self._config.get_main_config().getint("height", None)
if 'XDG_CURRENT_DESKTOP' in os.environ:
logging.warning("Running inside a desktop environment is not recommended")
if not self.width:
self.width = max(int(monitor.get_geometry().width * .5), 480)
if not self.height:
self.height = max(int(monitor.get_geometry().height * .5), 320)
if self.width or self.height:
logging.info("Setting windowed mode")
self.set_resizable(True)
self.windowed = True
else: