[gnome-tweaks/344-workspaces-tab-not-available] gshellwrapper: Fails to find Shell when its version is not from numbers only (#344)



commit 6acaa670ba7eeb41ae4c3f21471c943c27f6dc40
Author: Milan Crha <mcrha redhat com>
Date:   Thu Mar 18 11:35:25 2021 +0100

    gshellwrapper: Fails to find Shell when its version is not from numbers only (#344)
    
    Some tabs are hidden when Tweaks is run out of GNOME Shell, but
    the detection of the Shell running also expects the version number
    being only from the numbers. Since GNOME changed its version
    numbering the version can be "40.beta" and similar, which breaks
    Tweaks' code.
    
    As the version string was used only for a debug print, do not try
    to decode it and use it verbatim there.
    
    The second part of this change adds a print about the reason why it
    failed to find the Shell running. It'll help with further debugging.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-tweaks/-/issues/344

 gtweak/gshellwrapper.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gtweak/gshellwrapper.py b/gtweak/gshellwrapper.py
index cfd478e..6121375 100644
--- a/gtweak/gshellwrapper.py
+++ b/gtweak/gshellwrapper.py
@@ -90,14 +90,13 @@ class GnomeShellFactory:
         try:
             proxy = _ShellProxy()
             settings = GSettingsSetting("org.gnome.shell")
-            v = list(map(int, proxy.version.split(".")))
 
             self.shell = GnomeShell(proxy, settings)
 
-            logging.debug("Shell version: %s", str(v))
-        except:
+            logging.debug("Shell version: %s", proxy.version)
+        except Exception as e:
             self.shell = None
-            logging.warn("Shell not installed or running")
+            logging.warn("Shell not installed or running (error: " + str(e) + ")")
 
     def get_shell(self):
         return self.shell


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]