Suspend rotation while a live wallpaper is on screen

The extension's own log showed rotation kept firing ("Wallpaper
changed to ...") after live wallpaper playback had already started.
Each rotation change writes org.gnome.desktop.background's
picture-uri, which makes GNOME Shell repaint its own background actor
into the same _backgroundGroup our live wallpaper actor lives in,
landing on top of it and hiding the video/GIF entirely.

LiveWallpaperManager now takes an onActiveChanged callback, invoked
only on actual start/stop transitions, which extension.js uses to
suspend/unsuspend RotationManager. This is tracked separately from
user-initiated pause()/resume() so turning live wallpaper off restores
whatever rotation state the user actually had, and next()/previous()
now no-op while suspended so manual/forced-OLED wallpaper changes
can't sneak one in either. The indicator's "Next Wallpaper" item is
greyed out to match.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019RDqbdjsiisSU7CbQke4g8
This commit is contained in:
Claude
2026-08-04 00:33:01 +00:00
parent 4a5ef4fe86
commit d180c90434
5 changed files with 58 additions and 8 deletions
+11 -3
View File
@@ -21,9 +21,10 @@ import {loadGstreamerModules, GSTREAMER_INSTALL_HINT} from './gstreamerAvailabil
* that belongs to gnome-shell itself.
*/
export class LiveWallpaperManager {
constructor(settings, logger) {
constructor(settings, logger, {onActiveChanged} = {}) {
this._settings = settings;
this._logger = logger;
this._onActiveChanged = onActiveChanged ?? (() => {});
this._available = false;
this._active = false;
@@ -57,6 +58,13 @@ export class LiveWallpaperManager {
return this._active;
}
_setActive(active) {
if (this._active === active)
return;
this._active = active;
this._onActiveChanged(active);
}
async enable() {
await this._loadGstreamer();
@@ -149,7 +157,7 @@ export class LiveWallpaperManager {
this._applyMute();
this._playbin.set_state(Gst.State.PLAYING);
this._active = true;
this._setActive(true);
this._paused = false;
this._connectPowerWatches();
this._logger.debug(`Live wallpaper started: ${path}`);
@@ -336,7 +344,7 @@ export class LiveWallpaperManager {
this._videoWidth = 0;
this._videoHeight = 0;
this._active = false;
this._setActive(false);
this._paused = false;
}
}