Surface missing GStreamer deps in Preferences instead of only logging
Previously, if the Gst/GstApp/Cogl GI typelibs couldn't be loaded (e.g. gst-plugins-base/good not installed, only the bare gstreamer package), the only sign was a warning buried in the shell's log — the live wallpaper page looked fully functional and silently did nothing. Preferences now probes for the same bindings the running extension needs and shows a warning row with the exact import error plus per-distro install commands, and greys out the controls that only matter once GStreamer is actually available. Extracted the shared probing logic into lib/gstreamerAvailability.js so extension.js and prefs.js (separate processes) don't duplicate it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019RDqbdjsiisSU7CbQke4g8
This commit is contained in:
+3
-16
@@ -4,6 +4,7 @@ import Clutter from 'gi://Clutter';
|
||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||
|
||||
import {SettingsKey} from './settingsKeys.js';
|
||||
import {loadGstreamerModules, GSTREAMER_INSTALL_HINT} from './gstreamerAvailability.js';
|
||||
|
||||
/**
|
||||
* Plays a video or animated GIF file as a looping animated background.
|
||||
@@ -88,28 +89,14 @@ export class LiveWallpaperManager {
|
||||
|
||||
async _loadGstreamer() {
|
||||
try {
|
||||
// GstApp's binding itself is unused, but importing it registers
|
||||
// GstApp.AppSink with GJS so appsink elements expose 'new-sample'
|
||||
// and the 'pull-sample' action signal instead of being wrapped
|
||||
// as a generic, capability-less Gst.Element.
|
||||
const [{default: Gst}, , {default: Cogl}] = await Promise.all([
|
||||
import('gi://Gst?version=1.0'),
|
||||
import('gi://GstApp?version=1.0'),
|
||||
import('gi://Cogl'),
|
||||
]);
|
||||
|
||||
const {Gst, Cogl} = await loadGstreamerModules();
|
||||
this._Gst = Gst;
|
||||
this._Cogl = Cogl;
|
||||
|
||||
if (!Gst.is_initialized())
|
||||
Gst.init(null);
|
||||
|
||||
this._available = true;
|
||||
} catch (e) {
|
||||
this._available = false;
|
||||
this._logger.warn(
|
||||
'Live wallpaper unavailable: GStreamer/Cogl introspection bindings could not be loaded ' +
|
||||
`(${e.message ?? e}). Install GStreamer with its "good"/"base" plugin sets to enable this feature.`);
|
||||
`Live wallpaper unavailable: GStreamer/Cogl introspection bindings could not be loaded (${e.message ?? e}).\n${GSTREAMER_INSTALL_HINT}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user