screen: detect Desktop environment

This commit is contained in:
alfrix 2023-10-18 07:14:51 -03:00
parent 49e6dfd884
commit d5ec79e2ef
2 changed files with 11 additions and 0 deletions

View File

@ -184,3 +184,13 @@ def setup_logging(log_file, software_version):
logging.captureWarnings(True)
return listener, fh
def detect_desktop_environment():
try:
env = os.environ['XDG_CURRENT_DESKTOP']
logging.info(f"Session type: {os.environ['XDG_SESSION_TYPE']} DE: {env}")
if os.environ['XDG_CURRENT_DESKTOP']:
logging.warning("WARNING: Running inside a DE is not supported, and may lead to into problems")
except Exception as e:
logging.exception(f"Error:\n{e}\n\n{traceback.format_exc()}")

View File

@ -1070,6 +1070,7 @@ def main():
functions.patch_threading_excepthook()
logging.info(f"Python version: {sys.version_info.major}.{sys.version_info.minor}")
logging.info(f"KlipperScreen version: {version}")
functions.detect_desktop_environment()
if not Gtk.init_check():
logging.critical("Failed to initialize Gtk")
raise RuntimeError