[Xfce4-commits] [apps/catfish] 01/01: Add DE detection for headerbar usage: use headerbar for Budgie, GNOME, and Pantheon; titlebar for all others (bug #14486)

noreply at xfce.org noreply at xfce.org
Sun Jan 20 13:27:10 CET 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/catfish.

commit 75dce159cb602d9d2c6f23d937a2e10e8080e613
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sun Jan 20 07:27:01 2019 -0500

    Add DE detection for headerbar usage: use headerbar for Budgie, GNOME, and Pantheon; titlebar for all others (bug #14486)
---
 catfish_lib/CatfishSettings.py | 27 ++++++++++++++++++++++++++-
 po/catfish.pot                 |  2 +-
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/catfish_lib/CatfishSettings.py b/catfish_lib/CatfishSettings.py
index f1b0626..b46819e 100644
--- a/catfish_lib/CatfishSettings.py
+++ b/catfish_lib/CatfishSettings.py
@@ -21,7 +21,7 @@ import os
 default_settings_file = os.path.join(os.getenv('HOME'),
                                      '.config/catfish/catfish.rc')
 default_settings = {
-    'use-headerbar': True,
+    'use-headerbar': None,
     'show-hidden-files': False,
     'show-sidebar': False,
     'window-width': 650,
@@ -44,8 +44,22 @@ class CatfishSettings:
             self.settings_file = settings_file
         except Exception:
             self.settings_file = None
+        self.headerbar_configured = False
         self.read()
 
+    def get_current_desktop(self):
+        current_desktop = os.environ.get("XDG_CURRENT_DESKTOP", "")
+        current_desktop = current_desktop.lower()
+        for desktop in ["budgie", "pantheon", "gnome"]:
+            if desktop in current_desktop:
+                return desktop
+        if "kde" in current_desktop:
+            kde_version = int(os.environ.get("KDE_SESSION_VERSION", "4"))
+            if kde_version >= 5:
+                return "plasma"
+            return "kde"
+        return current_desktop
+
     def get_setting(self, key):
         """Return current setting for specified key."""
         if key in self.settings:
@@ -80,6 +94,15 @@ class CatfishSettings:
             except Exception:
                 pass
 
+        if self.settings['use-headerbar'] == None:
+            current_desktop = self.get_current_desktop()
+            if current_desktop in ["budgie", "gnome", "pantheon"]:
+                self.settings['use-headerbar'] = True
+            else:
+                self.settings['use-headerbar'] = False
+        else:
+            self.headerbar_configured = True
+
     def write(self):
         """Write the current settings to the settings rc-file."""
         if self.settings_file:
@@ -87,6 +110,8 @@ class CatfishSettings:
                 write_file = open(self.settings_file, 'w')
                 for key in list(self.settings.keys()):
                     value = self.settings[key]
+                    if key == 'use-headerbar' and not self.headerbar_configured:
+                        continue
                     if isinstance(value, bool):
                         value = str(value).lower()
                     else:
diff --git a/po/catfish.pot b/po/catfish.pot
index a44fef1..bd33072 100644
--- a/po/catfish.pot
+++ b/po/catfish.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-01-20 07:06-0500\n"
+"POT-Creation-Date: 2019-01-20 07:24-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list