Claude/gnome wallpaper auto rotation r1ailq #1

Merged
Quinta0 merged 12 commits from claude/gnome-wallpaper-auto-rotation-r1ailq into main 2026-08-04 20:53:28 +02:00
2 changed files with 31 additions and 10 deletions
Showing only changes of commit f7c05c2c76 - Show all commits
+26 -7
View File
@@ -1,14 +1,16 @@
/** /**
* Loads the GObject-Introspection bindings the live wallpaper feature needs * Loads the GObject-Introspection bindings the live wallpaper feature needs
* (Gst, GstApp for the appsink signals, Cogl for uploading decoded frames) * (Gst, GstApp for the appsink signals, Cogl for uploading decoded frames)
* and initializes GStreamer. Shared by extension.js (to actually run the * and initializes GStreamer. Used by liveWallpaper.js, which only ever runs
* pipeline) and prefs.js (to tell the user up front why the feature is * inside the gnome-shell process itself.
* 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*, * Cogl is Mutter's *private* library: its typelib is only reachable from
* since the user may install the missing packages and reopen preferences * gnome-shell's own process (which gets a private search path), never from
* without restarting the shell. * an ordinary GTK application. Do NOT reuse this for a diagnostic check in
* prefs.js — that runs in a separate, plain GTK4 process where importing
* Cogl will *always* fail regardless of whether live wallpapers actually
* work, producing a false "not found" report. Use
* checkGstreamerBaseAvailable() there instead.
*/ */
export async function loadGstreamerModules() { export async function loadGstreamerModules() {
const [{default: Gst}, , {default: Cogl}] = await Promise.all([ const [{default: Gst}, , {default: Cogl}] = await Promise.all([
@@ -23,6 +25,23 @@ export async function loadGstreamerModules() {
return {Gst, Cogl}; return {Gst, Cogl};
} }
/**
* Lighter check for prefs.js: confirms the system-wide GStreamer packages
* (Gst core + the "app" plugin providing GstApp) are installed, without
* touching Cogl. This can't fully confirm live wallpapers will work (that
* also needs Cogl, only checkable from inside gnome-shell itself), but a
* failure here is a genuine, actionable problem, unlike a Cogl probe.
*/
export async function checkGstreamerBaseAvailable() {
const [{default: Gst}] = await Promise.all([
import('gi://Gst?version=1.0'),
import('gi://GstApp?version=1.0'),
]);
if (!Gst.is_initialized())
Gst.init(null);
}
export const GSTREAMER_INSTALL_HINT = export const GSTREAMER_INSTALL_HINT =
'Install GStreamer’s "base" and "good" plugin sets (with their GObject-Introspection data), ' + 'Install GStreamer’s "base" and "good" plugin sets (with their GObject-Introspection data), ' +
'which provide playback and GIF decoding:\n' + 'which provide playback and GIF decoding:\n' +
+5 -3
View File
@@ -6,12 +6,12 @@ import Gdk from 'gi://Gdk';
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
import {SettingsKey} from './lib/settingsKeys.js'; import {SettingsKey} from './lib/settingsKeys.js';
import {loadGstreamerModules, GSTREAMER_INSTALL_HINT} from './lib/gstreamerAvailability.js'; import {checkGstreamerBaseAvailable, GSTREAMER_INSTALL_HINT} from './lib/gstreamerAvailability.js';
export default class BenthicBloomPreferences extends ExtensionPreferences { export default class BenthicBloomPreferences extends ExtensionPreferences {
async fillPreferencesWindow(window) { async fillPreferencesWindow(window) {
const settings = this.getSettings(); const settings = this.getSettings();
const gstreamerError = await loadGstreamerModules().then(() => null, e => e.message ?? String(e)); const gstreamerError = await checkGstreamerBaseAvailable().then(() => null, e => e.message ?? String(e));
window.set_default_size(640, 720); window.set_default_size(640, 720);
window.add(this._buildGeneralPage(settings)); window.add(this._buildGeneralPage(settings));
@@ -192,7 +192,9 @@ export default class BenthicBloomPreferences extends ExtensionPreferences {
description: _( description: _(
'Play a looping video or animated GIF as your desktop background instead of a static image. ' + 'Play a looping video or animated GIF as your desktop background instead of a static image. ' +
'Requires GStreamer (with its "good" and "base" plugin sets, which provide GIF decoding) ' + 'Requires GStreamer (with its "good" and "base" plugin sets, which provide GIF decoding) ' +
'to be installed on your system.'), 'to be installed on your system. Note: this page can only detect GStreamer being ' +
'completely missing — the rendering path it also needs is private to gnome-shell and can’t ' +
'be checked from here, so the absence of a warning below isn’t a full guarantee.'),
}); });
page.add(group); page.add(group);
group.add(this._switchRow( group.add(this._switchRow(