background: Check xml mime type instead of extension
This is required to be able to set animated wallpapers with the wallpaper portal, which names them 'background' without an extension. See https://gitlab.gnome.org/bertob/nostalgia/-/merge_requests/12 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1816>
This commit is contained in:
parent
1f0ef7fb46
commit
58ed969dd1
@ -101,6 +101,8 @@ const LoginManager = imports.misc.loginManager;
|
|||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
|
|
||||||
|
Gio._promisify(Gio._LocalFilePrototype, 'query_info_async', 'query_info_finish');
|
||||||
|
|
||||||
var DEFAULT_BACKGROUND_COLOR = Clutter.Color.from_pixel(0x2e3436ff);
|
var DEFAULT_BACKGROUND_COLOR = Clutter.Color.from_pixel(0x2e3436ff);
|
||||||
|
|
||||||
const BACKGROUND_SCHEMA = 'org.gnome.desktop.background';
|
const BACKGROUND_SCHEMA = 'org.gnome.desktop.background';
|
||||||
@ -479,8 +481,15 @@ var Background = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_loadFile(file) {
|
async _loadFile(file) {
|
||||||
if (file.get_basename().endsWith('.xml'))
|
const info = await file.query_info_async(
|
||||||
|
Gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
|
||||||
|
Gio.FileQueryInfoFlags.NONE,
|
||||||
|
0,
|
||||||
|
null);
|
||||||
|
|
||||||
|
const contentType = info.get_content_type();
|
||||||
|
if (contentType === 'application/xml')
|
||||||
this._loadAnimation(file);
|
this._loadAnimation(file);
|
||||||
else
|
else
|
||||||
this._loadImage(file);
|
this._loadImage(file);
|
||||||
|
Loading…
Reference in New Issue
Block a user