mutter/debian/patches/ubuntu/resolve_alternate_theme_path.patch
Ward Nakchbandi f8fb05fbbb first commit
2023-03-09 20:20:19 +03:00

51 lines
1.7 KiB
Diff

From: Didier Roche <didrocks@ubuntu.com>
Date: Tue, 22 Oct 2019 11:22:06 +0200
Subject: Resolve real path name for theme file
We are using alternative theme paths. Some of them are symlinks like
gdm3.css. It points to a different directory and we need to ensure
assets are loaded from the real theme path then (assets path are
relative to it).
Resolve them symlinks to ensure we use the original file itself when
loading the stylesheet.
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1798747
Forwarded: Not-needed (upstream doesn't support officially theming)
---
js/ui/main.js | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/js/ui/main.js b/js/ui/main.js
index fc5ae80..3bb9b8f 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -393,6 +393,14 @@ async function _handleLockScreenWarning() {
}
}
+function _realpath(path) {
+ try {
+ while (GLib.file_test(path, GLib.FileTest.IS_SYMLINK))
+ path = GLib.file_read_link(path);
+ } catch (e) { }
+ return path;
+}
+
function _getStylesheet(name) {
let stylesheet;
@@ -403,12 +411,12 @@ function _getStylesheet(name) {
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]);
- stylesheet = Gio.file_new_for_path(path);
+ stylesheet = Gio.file_new_for_path(_realpath(path));
if (stylesheet.query_exists(null))
return stylesheet;
}
- stylesheet = Gio.File.new_for_path(`${global.datadir}/theme/${name}`);
+ stylesheet = Gio.File.new_for_path(_realpath(`${global.datadir}/theme/${name}`));
if (stylesheet.query_exists(null))
return stylesheet;