Files
benthicbloom/lib/gstreamerAvailability.js
T
Claude 4a5ef4fe86 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
2026-08-04 00:26:53 +00:00

34 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Loads the GObject-Introspection bindings the live wallpaper feature needs
* (Gst, GstApp for the appsink signals, Cogl for uploading decoded frames)
* and initializes GStreamer. Shared by extension.js (to actually run the
* pipeline) and prefs.js (to tell the user up front why the feature is
* greyed out), since either process may be missing the system packages
* that provide these typelibs.
*
* Throws with a descriptive message on failure; never caches a *failure*,
* since the user may install the missing packages and reopen preferences
* without restarting the shell.
*/
export async function loadGstreamerModules() {
const [{default: Gst}, , {default: Cogl}] = await Promise.all([
import('gi://Gst?version=1.0'),
import('gi://GstApp?version=1.0'),
import('gi://Cogl'),
]);
if (!Gst.is_initialized())
Gst.init(null);
return {Gst, Cogl};
}
export const GSTREAMER_INSTALL_HINT =
'Install GStreamer’s "base" and "good" plugin sets (with their GObject-Introspection data), ' +
'which provide playback and GIF decoding:\n' +
'• Arch: sudo pacman -S gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav\n' +
'• Debian/Ubuntu: sudo apt install gstreamer1.0-plugins-base gstreamer1.0-plugins-good ' +
'gir1.2-gst-plugins-base-1.0\n' +
'• Fedora: sudo dnf install gstreamer1-plugins-base gstreamer1-plugins-good gobject-introspection\n' +
'Then restart GNOME Shell (log out and back in on Wayland).';