Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorShell::WallpaperService Class Reference

Asynchronous wallpaper-image source for shader backgrounds. More...

#include <phosphor-shell/include/PhosphorShell/WallpaperService.h>

Inheritance diagram for PhosphorShell::WallpaperService:
[legend]

Signals

void imageChanged ()
 

Public Member Functions

 WallpaperService (QObject *parent=nullptr)
 
 ~WallpaperService () override
 
QImage image () const
 
QString path () const
 
bool isAvailable () const
 
void refresh ()
 Re-query the provider and reload the wallpaper image if the path has changed.
 

Detailed Description

Asynchronous wallpaper-image source for shader backgrounds.

Wraps PhosphorShaders::createWallpaperProvider() to resolve the current desktop wallpaper path (Plasma / Hyprland / Sway / GNOME) and decodes the image on a worker thread via QThreadPool — a 4 K PNG decode would otherwise visibly stutter the shell.

The Plasma desktop-applets config file is watched when present so wallpaper changes from System Settings propagate automatically. Non-KDE desktops can call refresh() manually after writing a new wallpaper (e.g. through xdg-desktop-portal).

Usage from QML via PhosphorShell.wallpaper:

ShaderBackground {
    useWallpaper: PhosphorShell.wallpaper.available
    wallpaperTexture: PhosphorShell.wallpaper.image
}

Threading: every public method MUST be called from the GUI thread. The worker thread that decodes the image marshals back to the GUI thread via QMetaObject::invokeMethod, so consumers never see the worker's QImage directly.

Constructor & Destructor Documentation

◆ WallpaperService()

PhosphorShell::WallpaperService::WallpaperService ( QObject *  parent = nullptr)
explicit

◆ ~WallpaperService()

PhosphorShell::WallpaperService::~WallpaperService ( )
override

Member Function Documentation

◆ image()

QImage PhosphorShell::WallpaperService::image ( ) const

◆ imageChanged

void PhosphorShell::WallpaperService::imageChanged ( )
signal

◆ isAvailable()

bool PhosphorShell::WallpaperService::isAvailable ( ) const

◆ path()

QString PhosphorShell::WallpaperService::path ( ) const

◆ refresh()

void PhosphorShell::WallpaperService::refresh ( )

Re-query the provider and reload the wallpaper image if the path has changed.

Called automatically when the Plasma config file changes; QML can call manually to force a re-check.


The documentation for this class was generated from the following file: