feat(kwin): wallpapers for monitors and workspaces

Plasma keeps one wallpaper for each screen, not for each virtual desktop, so a
workspace that wants a picture of its own has nowhere to keep it in the shell.
komorebi sets the wallpaper of a screen when a workspace comes into view: the
workspace's own, else its monitor's. It does so however the workspace came into
view (a komorebic command, a pager, an application raising a window) and for the
workspace in front when it starts. A monitor and a workspace with no wallpaper
are left alone.

The Plasma shell sets it over D-Bus, with the call plasma-apply-wallpaperimage
makes, but for one screen. Backend::set_wallpaper asks for it every time a
workspace comes into view, and the KWin backend asks the shell what the screen
shows first, so a picture the user changed by hand is put back and one that is
already right is not touched. The request runs in the background, so switching
workspaces never waits for the shell, and goes on trying for about half a minute
when the shell is not up yet.

A wallpaper also gives the borders the colors of the palette made from its
picture, unless it says generate_theme is false, and theme_options choose the
variant and the color each border takes. The colors change before the workspace
is shown, so its borders are right at once.

komorebi.json takes the wallpaper of a monitor and the wallpaper of a workspace,
and a file that is read again shows the wallpaper of the workspace each monitor
has in front at once. vm-wallpaper runs against the real shell: set at start and
by workspace, a switch komorebi did not make, the colors of the borders, a
wallpaper changed by hand, the palette cache, and komorebi that starts before
the shell.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:49 -07:00
1 parent e6ddb5a7c9
commit 2b116ea2a3
25 files changed
+1881 -135

No files matched your search

+30
View File
@@ -490,6 +490,36 @@ outlives a login; the runtime directory, where the socket is, does not. The file
picture, a hash of its path, size and time of last change, and the variant. A palette that cannot
be kept is made again the next time. komorebi for Windows keeps them by file name alone.
## Why does komorebi set the wallpaper when a workspace comes into view?
Because Plasma keeps one wallpaper for each screen, not for each virtual desktop, and a
workspace is a virtual desktop. The shell shows what it was last told, whatever desktop is shown,
so komorebi tells it again as the workspace changes, as komorebi does on Windows and macOS. It does
so wherever a workspace comes into view (its own switches, a pager's, an application raising a
window of another workspace, and the start), since all of them change what the screen should show.
The picture fills the screen, as komorebi's wallpapers do on Windows.
## Why does komorebi ask the shell what the screen shows before it sets a wallpaper?
Because the workspace's wallpaper is asked for every time the workspace comes into view, and the
user may have changed the wallpaper by hand since: a wallpaper that is not the one komorebi wants
is put back, and one that already is, in the same plugin and fill mode, is not touched, so a
switch between two workspaces with the same picture changes nothing on the screen.
## Why is the wallpaper set in the background, and tried again?
Because the shell is another process, which may be slow, and may still be starting when komorebi is
(a session that has just logged in). Switching workspaces never waits for it: the backend notes the
wish for the output and a task on the runtime does the asking, so the request that runs last finds
the newest wish. A shell that is not there is asked again for about half a minute, with longer
waits, and then komorebi says once that it leaves wallpapers alone until the shell answers.
## Why does a wallpaper hand its theme to the borders by a call, and not by a message?
Because on Windows the theme of a wallpaper is sent to komorebi's own socket, and a message to
itself does nothing a call does not do. The call is made before the workspace is shown, so the
colors are the borders' by the time the first window of the workspace is given one.
## Why are the effects patched?
Because the stock effects lack what komorebi needs of them. Each patch leaves the effect