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:
+26
-2
@@ -31,6 +31,7 @@ export class RotationManager {
|
||||
this._timeoutId = 0;
|
||||
this._settingsSignals = [];
|
||||
this._paused = false;
|
||||
this._suspended = false;
|
||||
this._lastChangeTime = GLib.get_monotonic_time();
|
||||
this._currentPath = null;
|
||||
this._transitionOverlays = [];
|
||||
@@ -89,7 +90,7 @@ export class RotationManager {
|
||||
_restartTimer() {
|
||||
this._clearTimer();
|
||||
|
||||
if (this._paused || !this._settings.get_boolean(SettingsKey.ROTATION_ENABLED))
|
||||
if (this._paused || this._suspended || !this._settings.get_boolean(SettingsKey.ROTATION_ENABLED))
|
||||
return;
|
||||
|
||||
const interval = Math.max(
|
||||
@@ -118,7 +119,30 @@ export class RotationManager {
|
||||
this._restartTimer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Distinct from user-initiated pause(): called while a live wallpaper
|
||||
* is actually covering the desktop, so rotation doesn't keep changing
|
||||
* a static image nobody can see (which also churns the shell's own
|
||||
* background actor on top of the live wallpaper's). Resuming restores
|
||||
* whatever the user's own pause() state was, rather than forcing
|
||||
* rotation back on.
|
||||
*/
|
||||
suspend() {
|
||||
this._suspended = true;
|
||||
this._clearTimer();
|
||||
}
|
||||
|
||||
unsuspend() {
|
||||
this._suspended = false;
|
||||
this._restartTimer();
|
||||
}
|
||||
|
||||
async next({forced = false} = {}) {
|
||||
if (this._suspended) {
|
||||
this._logger.debug('Rotation suspended while live wallpaper is active');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._images.length === 0)
|
||||
await this._reloadImages();
|
||||
|
||||
@@ -144,7 +168,7 @@ export class RotationManager {
|
||||
}
|
||||
|
||||
async previous() {
|
||||
if (this._images.length === 0)
|
||||
if (this._suspended || this._images.length === 0)
|
||||
return;
|
||||
|
||||
const mode = this._settings.get_string(SettingsKey.ROTATION_MODE);
|
||||
|
||||
Reference in New Issue
Block a user