[gnome-shell-extensions] User theme: compatibility with XDG Base Directory



commit 2582ab4fd03a6a078a3ba2556e250bfdb64308b7
Author: Tomasz Gąsior <kontakt tomaszgasior pl>
Date:   Wed Feb 20 01:02:50 2019 +0100

    User theme: compatibility with XDG Base Directory
    
    See https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/55

 extensions/user-theme/extension.js | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/extensions/user-theme/extension.js b/extensions/user-theme/extension.js
index 9849731..d9d5b38 100644
--- a/extensions/user-theme/extension.js
+++ b/extensions/user-theme/extension.js
@@ -1,5 +1,5 @@
 // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*-
-// Load shell theme from ~/.themes/name/gnome-shell
+// Load shell theme from ~/.local/share/themes/name/gnome-shell
 /* exported init */
 
 const { Gio, GLib } = imports.gi;
@@ -34,11 +34,17 @@ class ThemeManager {
         let _themeName = this._settings.get_string(SETTINGS_KEY);
 
         if (_themeName) {
-            let _userCssStylesheet = GLib.build_filenamev([
+            let _userCssStylesheetCompat = GLib.build_filenamev([
                 GLib.get_home_dir(), '.themes', _themeName, 'gnome-shell', 'gnome-shell.css'
             ]);
+            let fileCompat = Gio.file_new_for_path(_userCssStylesheetCompat);
+            let _userCssStylesheet = GLib.build_filenamev([
+                GLib.get_user_data_dir(), 'themes', _themeName, 'gnome-shell', 'gnome-shell.css'
+            ]);
             let file = Gio.file_new_for_path(_userCssStylesheet);
-            if (file.query_exists(null))
+            if (fileCompat.query_exists(null))
+                _stylesheet = _userCssStylesheetCompat;
+            else if (file.query_exists(null))
                 _stylesheet = _userCssStylesheet;
             else {
                 let sysdirs = GLib.get_system_data_dirs();


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