From 14f35510fbb53b210eaff08adbf6c9f124fc8d68 Mon Sep 17 00:00:00 2001 From: eshanized Date: Sun, 29 Dec 2024 11:15:54 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20feat(err):=20for=20best=20error?= =?UTF-8?q?=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/share/snigdhaos-welcome/snigdhaos-welcome.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/usr/share/snigdhaos-welcome/snigdhaos-welcome.py b/usr/share/snigdhaos-welcome/snigdhaos-welcome.py index bdfeb7e..6aef4d1 100644 --- a/usr/share/snigdhaos-welcome/snigdhaos-welcome.py +++ b/usr/share/snigdhaos-welcome/snigdhaos-welcome.py @@ -119,10 +119,20 @@ class Main(Gtk.Window): internet_notifier_thread.start() # Start the thread def get_session(self): + """ + Retrieve the session type (e.g., X11, Wayland, etc.) from environment variables. + """ try: + # Attempt to get the session type from the environment variable self.session = os.environ.get("XDG_SESSION_TYPE") + + if not self.session: + # Log a warning if the session type is not found + print("Warning: 'XDG_SESSION_TYPE' is not set in the environment.") except Exception as e: - print("Exception in get_session(): %s" % e) + # Log the exception with details for debugging + print(f"Error retrieving session type in get_session(): {e}") + self.session = None # Ensure session is set to None on failure def on_settings_clicked(self, widget): self.toggle_popover()