|
| | WallpaperService (const QString &storePath, QObject *parent=nullptr) |
| | The shell-wide configured wallpaper: the all-screens entry, or when only per-screen entries exist, the first of those by name.
|
| | WallpaperService (const QString &storePath, std::unique_ptr< PhosphorShaders::IWallpaperProvider > seedProvider, QObject *parent=nullptr) |
| | Same, with the first-run seed source injected.
|
| | ~WallpaperService () override |
| QString | storePath () const |
| | Where the store lives, as the constructor was given it.
|
| QImage | image () const |
| QString | path () const |
| bool | isAvailable () const |
| QString | configuredPath (const QString &screenName=QString()) const |
| | The persisted wallpaper for screenName: its own entry, else the all-screens entry, else empty.
|
| QString | previewPath (const QString &screenName=QString()) const |
| | The transient preview for screenName, resolved the same way.
|
| QString | effectivePath (const QString &screenName=QString()) const |
| | What a surface on screenName should draw: the preview when one is set, otherwise the configured path.
|
| bool | setPath (const QString &path, const QString &screenName=QString()) |
| | Persist path as the wallpaper for screenName, or for every screen when the name is empty (which also drops the per-screen entries, since "all screens" means all of them).
|
| bool | setPreview (const QString &path, const QString &screenName=QString()) |
| | Show path on screenName (every screen when empty) without persisting it.
|
| void | clearPreview (const QString &screenName=QString()) |
| | Drop the preview for screenName, or every preview when the name is empty.
|
| void | setAppearance (const QVariantMap &wallpapers) |
| QVariantMap | appearanceSeed () const |
| QString | effectiveFit (const QString &screenName=QString()) const |
| void | refresh () |
| | Re-decode path into image, for a consumer that knows the file changed on disk under the same name.
|
The shell's own wallpaper: which image each output shows.
The shell owns the wallpaper surface, so this service is the store the surface reads and the picker writes. It is not a view onto another desktop's configuration. The store is a per-screen map keyed by output name, where the empty key is the wallpaper every output without an entry of its own shows, persisted at the store path the app hands the constructor (ShellEngine passes <config>/<shellName>/wallpaper.json, beside the shell file the loader discovers).
Two layers sit on top of the configured map, both per screen and both keyed the same way:
- the configured path: what setPath() wrote and what survives a restart;
- a transient preview: setPreview() / clearPreview(), which the picker uses to paint a hovered candidate under the windows without committing it. Never persisted.
effectivePath(screen) is what a surface on that output should draw: the preview if one is set (for that screen, else for all screens), otherwise the configured path (for that screen, else for all screens). effectivePathChanged(screen) fires whenever that answer may have changed for screen, with the empty name meaning every output.
First run: when the store is empty the service seeds it ONCE from the desktop the user is coming from (through PhosphorShaders::
createWallpaperProvider(), which reads Plasma / Hyprland / sway / GNOME configuration), so an existing session does not go black. After that seed the store is authoritative and the other desktop's configuration is never consulted again.
image is the decoded path (the shell-wide wallpaper), decoded on a worker thread via QThreadPool because a 4 K PNG decode would visibly stutter the shell, and pre-converted to RGBA8888 for ShaderBackground:
ShaderBackground {
useWallpaper: PhosphorShell.wallpaper.available
wallpaperTexture: PhosphorShell.wallpaper.image
}
Threading: every public method MUST be called from the GUI thread. The decode worker marshals back via QMetaObject::invokeMethod, so consumers never see the worker's QImage directly.