feat: add sleep/wake resilience, wallpaper shuffle controls, and stability fixes#212
Open
ziyadhussain23 wants to merge 1 commit intojeffshee:masterfrom
Open
Conversation
…ility fixes This commit introduces several features and robustness improvements to the Hanabi live wallpaper extension: ## Sleep/Wake Resilience - Add PrepareForSleep D-Bus listener on org.freedesktop.login1.Manager to gracefully handle system suspend and resume cycles. - SIGKILL the renderer process before suspend to avoid stale GStreamer pipelines that cause UI freezes on wake. - Automatically relaunch the renderer and force playback (setPlay) after a configurable delay on resume. - Introduce an _isSuspending guard to prevent autoPause from re-launching the renderer during the suspend window. - Suppress the playbackState mismatch handler during startup and wake to prevent the renderer from being force-paused before it is ready. ## Wallpaper Shuffle & Playback Controls - Add nextWallpaper and previousWallpaper D-Bus methods in dbus.js and renderer.js, enabling external scripts and panel controls to cycle through wallpapers. - Implement shuffle history tracking in the renderer so that previousWallpaper navigates back through recently played files. - Add a smooth fade transition between wallpapers using Clutter opacity animation, with a user-configurable fade-duration GSettings key. - Extend panelMenu.js with Previous Wallpaper button and a label showing the current wallpaper filename. ## DING Extension Compatibility - Guard the get_window_actors override in gnomeShellOverride.js so it is skipped when the DING (ding@rastersoft.com) extension is enabled, preventing 'replaceData.old_get_window_actors is undefined' errors. - Wrap _updateBackgrounds, _updateWorkspacesViews, and blur-my-shell hooks in _reloadBackgrounds with try-catch for defensive error handling. ## Disposed Actor Safety - Add an _isDestroyed flag to LiveWallpaper in wallpaper.js, set on the destroy signal, to guard against operations on disposed Clutter actors. - Cancel pending timeouts on destroy to prevent use-after-free crashes. - Wrap get_window_actors(false) calls in _getRenderer with try-catch. ## Preferences & Schema - Add fade-duration key to GSettings schema (default: 500 ms). - Add Fade Transition Duration SpinButton to the preferences UI. ## PlaybackState - Add suppressMismatch flag to playbackState.js to allow the extension to temporarily bypass the isPlayingChanged force-pause logic during startup and wake recovery windows. Files changed: src/dbus.js src/extension.js src/gnomeShellOverride.js src/panelMenu.js src/playbackState.js src/prefs.js src/renderer/renderer.js src/schemas/io.github.jeffshee.hanabi-extension.gschema.xml src/wallpaper.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces sleep/wake resilience, wallpaper shuffle & playback controls, DING extension compatibility, and several stability fixes to prevent crashes and UI freezes.
9 files changed — 482 insertions, 70 deletions.
Changes
1. Sleep/Wake Resilience (
extension.js)Problem: After system suspend/resume, the GStreamer renderer pipeline becomes stale, causing the entire GNOME Shell UI to freeze for 10–30 seconds on wake.
Solution:
org.freedesktop.login1.Manager→PrepareForSleepD-Bus signal.setPlay()D-Bus call to resume playback._isSuspendingflag to preventautoPausefrom accidentally re-launching the renderer during the suspend window.playbackStatemismatch handler during startup and wake recovery to prevent the renderer from being force-paused before it is ready.2. Wallpaper Shuffle & Playback Controls (
renderer.js,dbus.js,panelMenu.js)nextWallpaper/previousWallpaperD-Bus methods — enable cycling through wallpapers from external scripts, D-Bus calls, or the panel menu.previousWallpapernavigates back through recently played files (up to 50 entries).fade-durationGSettings key (default: 500 ms).3. DING Extension Compatibility (
gnomeShellOverride.js)Problem: When the DING desktop icons extension (
ding@rastersoft.com) is enabled alongside Hanabi, disabling/enabling Hanabi throwsreplaceData.old_get_window_actors is undefinedbecause both extensions overrideglobal.get_window_actors.Solution:
get_window_actorsoverride to avoid the conflict._updateBackgrounds,_updateWorkspacesViews, and blur-my-shell hooks in_reloadBackgrounds()with try-catch for defensive error handling.4. Disposed Actor Safety (
wallpaper.js)Problem: Race conditions during extension disable or monitor hotplug can cause operations on already-destroyed
LiveWallpaperClutter actors, leading to crashes.Solution:
_isDestroyedflag set on thedestroysignal._applyWallpapercallback and other async operations against destroyed actors.get_window_actors(false)in_getRenderer()with try-catch.5. PlaybackState Mismatch Suppression (
playbackState.js)suppressMismatchboolean flag that the extension sets during startup (first 5 seconds) and wake recovery to temporarily bypass theisPlayingChangedforce-pause logic.6. Preferences & Schema (
prefs.js,gschema.xml)fade-durationkey to GSettings schema (integer, default 500 ms, range 0–5000).Files Changed
src/extension.jssrc/renderer/renderer.jssrc/gnomeShellOverride.jssrc/panelMenu.jssrc/dbus.jssrc/playbackState.jssrc/wallpaper.jssrc/prefs.jssrc/schemas/...gschema.xmlTesting