From da96408098cdf1735b2c7a1b1c722ecb2a263ce9 Mon Sep 17 00:00:00 2001 From: Didier Roche Date: Fri, 30 Mar 2018 09:44:14 +0200 Subject: [PATCH] ui: Theme lookup should respect XDG_DATA_DIRS Modes, extensions and other GNOME Shell assets are searched in appropriate subdirectories of each directory in XDG_DATA_DIRS, falling back to global.datadir. However, this isn't the case for themes, which are currently always expected in global.datadir, even when referenced by a mode in a different XDG_DATA_DIR. The fix is to have the theme finding pattern follow the same logic as other elements. Fixes #167. (cherry picked from commit d6d09fd3c82dd39dac1a764073040b57baeb8659) --- js/ui/main.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/ui/main.js b/js/ui/main.js index 2cfe941be..d86cf9e81 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -256,6 +256,14 @@ function _getStylesheet(name) { if (stylesheet.query_exists(null)) return stylesheet; + let dataDirs = GLib.get_system_data_dirs(); + for (let i = 0; i < dataDirs.length; i++) { + let path = GLib.build_filenamev([dataDirs[i], 'gnome-shell', 'theme', name]); + let stylesheet = Gio.file_new_for_path(path); + if (stylesheet.query_exists(null)) + return stylesheet; + } + stylesheet = Gio.File.new_for_path(global.datadir + '/theme/' + name); if (stylesheet.query_exists(null)) return stylesheet;