Răsfoiți Sursa

Fixed crash on Mint Cinnamon due to the main thread jumping to address 0x0 from AlbumTexture::copyContents

UwU 1 lună în urmă
părinte
comite
360bd78869
43 a modificat fișierele cu 2318 adăugiri și 66 ștergeri
  1. 12 0
      CMakeLists.txt
  2. 2 2
      CMakeModules/FindV8.cmake
  3. 262 0
      protocols/cosmic-toplevel-info-unstable-v1.xml
  4. 400 0
      protocols/cosmic-workspace-unstable-v1.xml
  5. 219 0
      protocols/ext-foreign-toplevel-list-v1.xml
  6. 422 0
      protocols/ext-workspace-v1.xml
  7. 1 1
      src/WallpaperEngine/Render/AlbumTexture.cpp
  8. 160 3
      src/WallpaperEngine/Render/Drivers/Detectors/WaylandFullScreenDetector.cpp
  9. 15 2
      src/WallpaperEngine/Render/Drivers/Detectors/WaylandFullScreenDetector.h
  10. 46 0
      src/WallpaperEngine/Render/Drivers/GLFWOpenGLDriver.cpp
  11. 7 0
      src/WallpaperEngine/Render/Drivers/GLFWOpenGLDriver.h
  12. 27 0
      src/WallpaperEngine/Render/Drivers/Output/GLFWWindowOutput.cpp
  13. 1 0
      src/WallpaperEngine/Render/Drivers/Output/GLFWWindowOutput.h
  14. 1 0
      tools/linuxvm/.gitignore
  15. 49 26
      tools/linuxvm/RELEASE_TESTING.md
  16. 55 0
      tools/linuxvm/autostart_check.sh
  17. 48 0
      tools/linuxvm/bump_deb.py
  18. 45 0
      tools/linuxvm/deps_check.sh
  19. 4 2
      tools/linuxvm/fake_github.py
  20. 54 0
      tools/linuxvm/flatpak_check.sh
  21. 5 3
      tools/linuxvm/fullscreen_window.py
  22. 59 19
      tools/linuxvm/guest_test.sh
  23. 7 2
      tools/linuxvm/host_shots.sh
  24. 21 2
      tools/linuxvm/linuxvm.sh
  25. 15 0
      tools/linuxvm/maximize_kde.sh
  26. 9 0
      tools/linuxvm/openssl_proot.sh
  27. 6 0
      tools/linuxvm/profiles/arch-xfce.sh
  28. 8 0
      tools/linuxvm/profiles/bazzite.sh
  29. 6 0
      tools/linuxvm/profiles/debian-gnome.sh
  30. 6 0
      tools/linuxvm/profiles/debian-xfce.sh
  31. 6 0
      tools/linuxvm/profiles/fedora-gnome.sh
  32. 7 0
      tools/linuxvm/profiles/fedora-kde.sh
  33. 7 0
      tools/linuxvm/profiles/manjaro-kde.sh
  34. 7 0
      tools/linuxvm/profiles/opensuse-kde.sh
  35. 8 0
      tools/linuxvm/profiles/opensuse-leap.sh
  36. 6 0
      tools/linuxvm/profiles/opensuse-xfce.sh
  37. 8 0
      tools/linuxvm/profiles/popos-cosmic.sh
  38. 6 0
      tools/linuxvm/profiles/ubuntu-gnome.sh
  39. 139 0
      tools/linuxvm/release_check.sh
  40. 4 3
      tools/linuxvm/run_behavior.sh
  41. 75 0
      tools/linuxvm/update_check.sh
  42. 68 0
      tools/linuxvm/wem_check.sh
  43. 5 1
      tools/package_release.sh

+ 12 - 0
CMakeLists.txt

@@ -203,6 +203,17 @@ if(WAYLAND_SUPPORT_FOUND)
     add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/xdg-output-unstable-v1-protocol.c
         COMMAND ${WaylandScanner} private-code ${WAYLAND_PROTOCOLS_DIR}/unstable/xdg-output/xdg-output-unstable-v1.xml ${WAYLAND_OUTPUT_DIR}/xdg-output-unstable-v1-protocol.c)
 
+    # COSMIC's window state: cosmic-comp has no wlr foreign toplevel, it speaks ext-foreign-toplevel-list plus its own
+    # toplevel info extension (which refers to the workspace interfaces)
+    set(COSMIC_PROTOCOL_SOURCES)
+    foreach(proto cosmic-toplevel-info-unstable-v1 cosmic-workspace-unstable-v1 ext-foreign-toplevel-list-v1 ext-workspace-v1)
+        add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/${proto}-protocol.h
+            COMMAND ${WaylandScanner} client-header ${CMAKE_CURRENT_SOURCE_DIR}/protocols/${proto}.xml ${WAYLAND_OUTPUT_DIR}/${proto}-protocol.h)
+        add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/${proto}-protocol.c
+            COMMAND ${WaylandScanner} private-code ${CMAKE_CURRENT_SOURCE_DIR}/protocols/${proto}.xml ${WAYLAND_OUTPUT_DIR}/${proto}-protocol.c)
+        list(APPEND COSMIC_PROTOCOL_SOURCES ${WAYLAND_OUTPUT_DIR}/${proto}-protocol.c ${WAYLAND_OUTPUT_DIR}/${proto}-protocol.h)
+    endforeach()
+
     include_directories(${WAYLAND_SUPPORT_INCLUDE_DIRS})
     include_directories(${WAYLAND_OUTPUT_DIR})
     set(WAYLAND_LIBRARIES
@@ -242,6 +253,7 @@ if(WAYLAND_SUPPORT_FOUND)
         ${WAYLAND_OUTPUT_DIR}/fractional-scale-v1-protocol.h
         ${WAYLAND_OUTPUT_DIR}/viewporter-protocol.c
         ${WAYLAND_OUTPUT_DIR}/viewporter-protocol.h
+        ${COSMIC_PROTOCOL_SOURCES}
         ${WAYLAND_OUTPUT_DIR}/ext-idle-notify-v1-protocol.c
         ${WAYLAND_OUTPUT_DIR}/ext-idle-notify-v1-protocol.h)
 

+ 2 - 2
CMakeModules/FindV8.cmake

@@ -1,5 +1,5 @@
 # Finds V8 the way distributions ship it: inside Node.js's shared library (Fedora nodejs<N>-devel, Debian/Ubuntu
-# libnode-dev), headers under include/node (include/libnode on Arch's AUR libnode). V8_INCLUDE_DIR / V8_LIBRARY can
+# libnode-dev), headers under include/node (include/libnode on Arch's AUR libnode, include/node<N> on openSUSE). V8_INCLUDE_DIR / V8_LIBRARY can
 # point anywhere else.
 #
 # This module defines:
@@ -34,7 +34,7 @@ find_path(
   V8_INCLUDE_DIR
   NAMES v8.h
   HINTS ${PC_NODE_INCLUDE_DIRS} ${_V8_PREFIX_HINTS}
-  PATH_SUFFIXES libnode node nodejs/deps/v8/include v8
+  PATH_SUFFIXES libnode node node26 node25 node24 node22 nodejs/deps/v8/include v8
 )
 
 set(V8_DEFINITIONS)

+ 262 - 0
protocols/cosmic-toplevel-info-unstable-v1.xml

@@ -0,0 +1,262 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="cosmic_toplevel_info_unstable_v1">
+  <copyright>
+    Copyright © 2018 Ilia Bozhinov
+    Copyright © 2020 Isaac Freund
+    Copyright © 2024 Victoria Brekenfeld
+
+    Permission to use, copy, modify, distribute, and sell this
+    software and its documentation for any purpose is hereby granted
+    without fee, provided that the above copyright notice appear in
+    all copies and that both that copyright notice and this permission
+    notice appear in supporting documentation, and that the name of
+    the copyright holders not be used in advertising or publicity
+    pertaining to distribution of the software without specific,
+    written prior permission.  The copyright holders make no
+    representations about the suitability of this software for any
+    purpose.  It is provided "as is" without express or implied
+    warranty.
+
+    THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+    SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+    FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+    SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+    AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+    THIS SOFTWARE.
+  </copyright>
+
+  <interface name="zcosmic_toplevel_info_v1" version="3">
+    <description summary="list toplevels and properties thereof">
+      The purpose of this protocol is to enable clients such as taskbars
+      or docks to access a list of opened applications and basic properties
+      thereof.
+
+      It thus extends ext_foreign_toplevel_v1 to provide more information
+      and actions on foreign toplevels.
+    </description>
+
+    <event name="toplevel" deprecated-since="2">
+      <description summary="a toplevel has been created">
+        This event is never emitted for clients binding version 2
+        of this protocol, they should use `get_cosmic_toplevel` instead.
+
+        This event is emitted for clients binding version 1 whenever a
+        new toplevel window is created. It is emitted for all toplevels,
+        regardless of the app that has created them.
+
+        All initial properties of the toplevel (title, app_id, states, etc.)
+        will be sent immediately after this event via the corresponding
+        events in zcosmic_toplevel_handle_v1.
+      </description>
+      <arg name="toplevel" type="new_id" interface="zcosmic_toplevel_handle_v1"/>
+    </event>
+
+    <request name="stop" deprecated-since="2">
+      <description summary="stop sending events">
+        This request indicates that the client no longer wishes to receive
+        events for new toplevels.  However, the compositor may emit further
+        toplevel_created events until the finished event is emitted.
+
+        The client must not send any more requests after this one.
+
+        Note: This request isn't necessary for clients binding version 2
+        of this protocol and will be ignored.
+      </description>
+    </request>
+
+    <event name="finished" deprecated-since="2">
+      <description summary="the compositor has finished with the toplevel manager">
+        This event indicates that the compositor is done sending events
+        to the zcosmic_toplevel_info_v1. The server will destroy the
+        object immediately after sending this request, so it will become
+        invalid and the client should free any resources associated with it.
+
+        Note: This event is emitted immediately after calling `stop` for
+        clients binding version 2 of this protocol for backwards compatibility.
+      </description>
+    </event>
+
+    <request name="get_cosmic_toplevel" since="2">
+      <description summary="get cosmic toplevel extension object">
+        Request a zcosmic_toplevel_handle_v1 extension object for an existing
+        ext_foreign_toplevel_handle_v1.
+
+        All initial properties of the toplevel (states, etc.)
+        will be sent immediately after this event via the corresponding
+        events in zcosmic_toplevel_handle_v1.
+      </description>
+      <arg name="cosmic_toplevel" type="new_id" interface="zcosmic_toplevel_handle_v1"/>
+      <arg name="foreign_toplevel" type="object" interface="ext_foreign_toplevel_handle_v1"/>
+    </request>
+
+    <event name="done" since="2">
+      <description summary="all information about active toplevels have been sent">
+        This event is sent after all changes for currently active
+        zcosmic_toplevel_handle_v1 have been sent.
+
+        This allows changes to multiple zcosmic_toplevel_handle_v1 handles
+        and their properties to be seen as atomic, even if they happen via
+        multiple events.
+      </description>
+    </event>
+  </interface>
+
+  <interface name="zcosmic_toplevel_handle_v1" version="3">
+    <description summary="an open toplevel">
+      A zcosmic_toplevel_handle_v1 object represents an open toplevel
+      window. A single app may have multiple open toplevels.
+
+      Each toplevel has a list of outputs it is visible on, exposed to the
+      client via the output_enter and output_leave events.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the zcosmic_toplevel_handle_v1 object">
+        This request should be called either when the client will no longer
+        use the zcosmic_toplevel_handle_v1.
+      </description>
+    </request>
+
+    <event name="closed" deprecated-since="2">
+      <description summary="the toplevel has been closed">
+        The server will emit no further events on the
+        zcosmic_toplevel_handle_v1 after this event. Any requests received
+        aside from the destroy request will be ignored. Upon receiving this
+        event, the client should make the destroy request to allow freeing
+        of resources.
+
+        Note: This event will not be emitted for clients binding version 2
+        of this protocol, as `ext_foreign_toplevel_handle_v1.closed` is
+        equivalent.
+      </description>
+    </event>
+
+    <event name="done" deprecated-since="2">
+      <description summary="all information about the toplevel has been sent">
+        This event is sent after all changes in the toplevel state have
+        been sent.
+
+        This allows changes to the zcosmic_toplevel_handle_v1 properties
+        to be seen as atomic, even if they happen via multiple events.
+
+        Note: this is is not sent after the closed event.
+
+        Note: This event will not be emitted for clients binding version 2
+        of this protocol, as `ext_foreign_toplevel_handle_v1.done` is
+        equivalent.
+      </description>
+    </event>
+
+    <event name="title" deprecated-since="2">
+      <description summary="title change">
+        This event is emitted whenever the title of the toplevel changes.
+
+        Note: This event will not be emitted for clients binding version 2
+        of this protocol, as `ext_foreign_toplevel_handle_v1.title` is
+        equivalent.
+      </description>
+      <arg name="title" type="string"/>
+    </event>
+
+    <event name="app_id" deprecated-since="2">
+      <description summary="app_id change">
+        This event is emitted whenever the app_id of the toplevel changes.
+
+        Note: This event will not be emitted for clients binding version 2
+        of this protocol, as `ext_foreign_toplevel_handle_v1.app_id` is
+        equivalent.
+      </description>
+      <arg name="app_id" type="string"/>
+    </event>
+
+    <event name="output_enter">
+      <description summary="toplevel entered an output">
+        This event is emitted whenever the toplevel becomes visible on the
+        given output. A toplevel may be visible on multiple outputs.
+      </description>
+      <arg name="output" type="object" interface="wl_output"/>
+    </event>
+
+    <event name="output_leave">
+      <description summary="toplevel left an output">
+        This event is emitted whenever the toplevel is no longer visible
+        on a given output. It is guaranteed that an output_enter event with
+        the same output has been emitted before this event.
+      </description>
+      <arg name="output" type="object" interface="wl_output"/>
+    </event>
+
+    <event name="workspace_enter" deprecated-since="3">
+      <description summary="toplevel entered an workspace">
+        This event is emitted whenever the toplevel becomes visible on the
+        given workspace. A toplevel may be visible on multiple workspaces.
+      </description>
+      <arg name="workspace" type="object" interface="zcosmic_workspace_handle_v1"/>
+    </event>
+
+    <event name="workspace_leave" deprecated-since="3">
+      <description summary="toplevel left an workspace">
+        This event is emitted whenever the toplevel is no longer visible
+        on a given workspace. It is guaranteed that an workspace_enter event with
+        the same workspace has been emitted before this event.
+      </description>
+      <arg name="workspace" type="object" interface="zcosmic_workspace_handle_v1"/>
+    </event>
+
+    <enum name="state">
+      <description summary="types of states on the toplevel">
+        The different states that a toplevel may have. These have the same
+        meaning as the states with the same names defined in xdg-toplevel
+      </description>
+      <entry name="maximized"  value="0" summary="the toplevel is maximized"  />
+      <entry name="minimized"  value="1" summary="the toplevel is minimized"  />
+      <entry name="activated"  value="2" summary="the toplevel is active"     />
+      <entry name="fullscreen" value="3" summary="the toplevel is fullscreen" />
+      <entry name="sticky"     value="4" summary="the toplevel is sticky"     since="2" />
+    </enum>
+
+    <event name="state">
+      <description summary="the toplevel state changed">
+        This event is emitted once on creation of the
+        zcosmic_toplevel_handle_v1 and again whenever the state of the
+        toplevel changes.
+      </description>
+      <arg name="state" type="array"/>
+    </event>
+
+    <event name="geometry" since="2">
+      <description summary="the toplevel's position and/or size has changed">
+        Emitted when the geometry of a toplevel (it's position and/or size)
+        relative to the provided output has changed.
+
+        This event is emitted once on creation of the
+        zcosmic_toplevel_handle_v1 for every entered output and again
+        whenever the geometry of the toplevel changes relative to any output.
+      </description>
+      <arg name="output" type="object" interface="wl_output"/>
+      <arg name="x" type="int" summary="x coordinate of the upper-left corner"/>
+      <arg name="y" type="int" summary="y coordinate of the upper-left corner"/>
+      <arg name="width" type="int" summary="width of the toplevel"/>
+      <arg name="height" type="int" summary="height of the toplevel"/>
+    </event>
+
+    <event name="ext_workspace_enter" since="3">
+      <description summary="toplevel entered an workspace">
+        This event is emitted whenever the toplevel becomes visible on the
+        given workspace. A toplevel may be visible on multiple workspaces.
+      </description>
+      <arg name="workspace" type="object" interface="ext_workspace_handle_v1"/>
+    </event>
+
+    <event name="ext_workspace_leave" since="3">
+      <description summary="toplevel left an workspace">
+        This event is emitted whenever the toplevel is no longer visible
+        on a given workspace. It is guaranteed that an workspace_enter event with
+        the same workspace has been emitted before this event.
+      </description>
+      <arg name="workspace" type="object" interface="ext_workspace_handle_v1"/>
+    </event>
+  </interface>
+</protocol>

+ 400 - 0
protocols/cosmic-workspace-unstable-v1.xml

@@ -0,0 +1,400 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="cosmic_workspace_unstable_v1">
+  <copyright>
+    Copyright © 2019 Christopher Billington
+    Copyright © 2020 Ilia Bozhinov
+    Copyright © 2022 Victoria Brekenfeld
+
+    Permission to use, copy, modify, distribute, and sell this
+    software and its documentation for any purpose is hereby granted
+    without fee, provided that the above copyright notice appear in
+    all copies and that both that copyright notice and this permission
+    notice appear in supporting documentation, and that the name of
+    the copyright holders not be used in advertising or publicity
+    pertaining to distribution of the software without specific,
+    written prior permission.  The copyright holders make no
+    representations about the suitability of this software for any
+    purpose.  It is provided "as is" without express or implied
+    warranty.
+
+    THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+    SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+    FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+    SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+    AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+    THIS SOFTWARE.
+  </copyright>
+
+  <interface name="zcosmic_workspace_manager_v1" version="2">
+    <description summary="list and control workspaces">
+      Workspaces, also called virtual desktops, are groups of surfaces. A
+      compositor with a concept of workspaces may only show some such groups of
+      surfaces (those of 'active' workspaces) at a time. 'Activating' a
+      workspace is a request for the compositor to display that workspace's
+      surfaces as normal, whereas the compositor may hide or otherwise
+      de-emphasise surfaces that are associated only with 'inactive' workspaces.
+      Workspaces are grouped by which sets of outputs they correspond to, and
+      may contain surfaces only from those outputs. In this way, it is possible
+      for each output to have its own set of workspaces, or for all outputs (or
+      any other arbitrary grouping) to share workspaces. Compositors may
+      optionally conceptually arrange each group of workspaces in an
+      N-dimensional grid.
+
+      The purpose of this protocol is to enable the creation of taskbars and
+      docks by providing them with a list of workspaces and their properties,
+      and allowing them to activate and deactivate workspaces.
+
+      After a client binds the zcosmic_workspace_manager_v1, each workspace will be
+      sent via the workspace event.
+    </description>
+
+    <event name="workspace_group">
+      <description summary="a workspace group has been created">
+        This event is emitted whenever a new workspace group has been created.
+
+        All initial details of the workspace group (workspaces, outputs) will be
+        sent immediately after this event via the corresponding events in
+        zcosmic_workspace_group_handle_v1.
+      </description>
+      <arg name="workspace_group" type="new_id" interface="zcosmic_workspace_group_handle_v1"/>
+    </event>
+
+    <request name="commit">
+      <description summary="all requests about the workspaces have been sent">
+        The client must send this request after it has finished sending other
+        requests. The compositor must process a series of requests preceding a
+        commit request atomically.
+
+        This allows changes to the workspace properties to be seen as atomic,
+        even if they happen via multiple events, and even if they involve
+        multiple zcosmic_workspace_handle_v1 objects, for example, deactivating one
+        workspace and activating another.
+      </description>
+    </request>
+
+    <event name="done">
+      <description summary="all information about the workspace groups has been sent">
+        This event is sent after all changes in all workspace groups have been
+        sent.
+
+        This allows changes to one or more zcosmic_workspace_group_handle_v1
+        properties and zcosmic_workspace_handle_v1 properties to be seen as atomic,
+        even if they happen via multiple events.
+        In particular, an output moving from one workspace group to
+        another sends an output_enter event and an output_leave event to the two
+        zcosmic_workspace_group_handle_v1 objects in question. The compositor sends
+        the done event only after updating the output information in both
+        workspace groups.
+      </description>
+    </event>
+
+    <event name="finished">
+      <description summary="the compositor has finished with the workspace_manager">
+        This event indicates that the compositor is done sending events to the
+        zcosmic_workspace_manager_v1. The server will destroy the object
+        immediately after sending this request, so it will become invalid and
+        the client should free any resources associated with it.
+      </description>
+    </event>
+
+    <request name="stop">
+      <description summary="stop sending events">
+        Indicates the client no longer wishes to receive events for new
+        workspace groups. However the compositor may emit further workspace
+        events, until the finished event is emitted.
+
+        The client must not send any more requests after this one.
+      </description>
+    </request>
+  </interface>
+
+  <interface name="zcosmic_workspace_group_handle_v1" version="2">
+    <description summary="a workspace group assigned to a set of outputs">
+      A zcosmic_workspace_group_handle_v1 object represents a a workspace group
+      that is assigned a set of outputs and contains a number of workspaces.
+
+      The set of outputs assigned to the workspace group is conveyed to the client via
+      output_enter and output_leave events, and its workspaces are conveyed with
+      workspace events.
+
+      For example, a compositor which has a set of workspaces for each output may
+      advertise a workspace group (and its workspaces) per output, whereas a compositor
+      where a workspace spans all outputs may advertise a single workspace group for all
+      outputs.
+    </description>
+
+    <enum name="zcosmic_workspace_group_capabilities_v1">
+      <entry name="create_workspace" value="1" summary="create_workspace request is available"/>
+    </enum>
+
+    <event name="capabilities">
+      <description summary="compositor capabilities">
+        This event advertises the capabilities supported by the compositor. If
+        a capability isn't supported, clients should hide or disable the UI
+        elements that expose this functionality. For instance, if the
+        compositor doesn't advertise support for creating workspaces, a button
+        triggering the create_workspace request should not be displayed.
+
+        The compositor will ignore requests it doesn't support. For instance,
+        a compositor which doesn't advertise support for creating workspaces will ignore
+        create_workspace requests.
+
+        Compositors must send this event once after creation of an
+        zcosmic_workspace_group_handle_v1 . When the capabilities change, compositors
+        must send this event again.
+
+        The capabilities are sent as an array of 32-bit unsigned integers in
+        native endianness.
+      </description>
+      <arg name="capabilities" type="array" summary="array of 32-bit capabilities"/>
+    </event>
+
+    <event name="output_enter">
+      <description summary="output assigned to workspace group">
+        This event is emitted whenever an output is assigned to the workspace
+        group.
+      </description>
+      <arg name="output" type="object" interface="wl_output"/>
+    </event>
+
+    <event name="output_leave">
+      <description summary="output removed from workspace group">
+        This event is emitted whenever an output is removed from the workspace
+        group.
+      </description>
+      <arg name="output" type="object" interface="wl_output"/>
+    </event>
+
+    <event name="workspace">
+      <description summary="workspace added to workspace group">
+        This event is emitted whenever a new workspace has been created.
+        A workspace can only be a member of a single workspace group and cannot
+        be re-assigned.
+
+        All initial details of the workspace (name, coordinates, state) will
+        be sent immediately after this event via the corresponding events in
+        zcosmic_workspace_handle_v1.
+      </description>
+      <arg name="workspace" type="new_id" interface="zcosmic_workspace_handle_v1"/>
+    </event>
+
+    <event name="remove">
+      <description summary="this workspace group has been destroyed">
+        This event means the zcosmic_workspace_group_handle_v1 has been destroyed.
+        It is guaranteed there won't be any more events for this
+        zcosmic_workspace_group_handle_v1. The zext_workspace_group_handle_v1 becomes
+        inert so any requests will be ignored except the destroy request.
+
+        The compositor must remove all workspaces belonging to a workspace group
+        before removing the workspace group.
+      </description>
+    </event>
+
+    <request name="create_workspace">
+      <description summary="create a new workspace">
+        Request that the compositor create a new workspace with the given name.
+
+        There is no guarantee that the compositor will create a new workspace,
+        or that the created workspace will have the provided name.
+      </description>
+      <arg name="workspace" type="string"/>
+    </request>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the zcosmic_workspace_group_handle_v1 object">
+        Destroys the zcosmic_workspace_group_handle_v1 object.
+
+        This request should be called either when the client does not want to
+        use the workspace object any more or after the remove event to finalize
+        the destruction of the object.
+      </description>
+    </request>
+  </interface>
+
+  <interface name="zcosmic_workspace_handle_v1" version="2">
+    <description summary="a workspace handing a group of surfaces">
+      A zcosmic_workspace_handle_v1 object represents a a workspace that handles a
+      group of surfaces.
+
+      Each workspace has a name, conveyed to the client with the name event; a
+      list of states, conveyed to the client with the state event; and
+      optionally a set of coordinates, conveyed to the client with the
+      coordinates event. The client may request that the compositor activate or
+      deactivate the workspace.
+
+      Each workspace can belong to only a single workspace group.
+      Depepending on the compositor policy, there might be workspaces with
+      the same name in different workspace groups, but these workspaces are still
+      separate (e.g. one of them might be active while the other is not).
+    </description>
+
+    <event name="name">
+      <description summary="workspace name changed">
+        This event is emitted immediately after the zcosmic_workspace_handle_v1 is
+        created and whenever the name of the workspace changes.
+      </description>
+      <arg name="name" type="string"/>
+    </event>
+
+    <event name="coordinates">
+      <description summary="workspace coordinates changed">
+        This event is used to organize workspaces into an N-dimensional grid
+        within a workspace group, and if supported, is emitted immediately after
+        the zcosmic_workspace_handle_v1 is created and whenever the coordinates of
+        the workspace change. Compositors may not send this event if they do not
+        conceptually arrange workspaces in this way. If compositors simply
+        number workspaces, without any geometric interpretation, they may send
+        1D coordinates, which clients should not interpret as implying any
+        geometry. Sending an empty array means that the compositor no longer
+        orders the workspace geometrically.
+
+        Coordinates have an arbitrary number of dimensions N with an uint32
+        position along each dimension. By convention if N > 1, the first
+        dimension is X, the second Y, the third Z, and so on. The compositor may
+        chose to utilize these events for a more novel workspace layout
+        convention, however. No guarantee is made about the grid being filled or
+        bounded; there may be a workspace at coordinate 1 and another at
+        coordinate 1000 and none in between. Within a workspace group, however,
+        workspaces must have unique coordinates of equal dimensionality.
+      </description>
+      <arg name="coordinates" type="array"/>
+    </event>
+
+    <event name="state">
+      <description summary="the state of the workspace changed">
+        This event is emitted immediately after the zcosmic_workspace_handle_v1 is
+        created and each time the workspace state changes, either because of a
+        compositor action or because of a request in this protocol.
+      </description>
+      <arg name="state" type="array"/>
+    </event>
+
+    <enum name="state">
+      <description summary="types of states on the workspace">
+        The different states that a workspace can have.
+      </description>
+
+      <entry name="active" value="0" summary="the workspace is active"/>
+      <entry name="urgent" value="1" summary="the workspace requests attention"/>
+      <entry name="hidden" value="2">
+        <description summary="the workspace is not visible">
+          The workspace is not visible in its workspace group, and clients
+          attempting to visualize the compositor workspace state should not
+          display such workspaces.
+        </description>
+      </entry>
+    </enum>
+
+    <enum name="zcosmic_workspace_capabilities_v1">
+      <entry name="activate" value="1" summary="activate request is available"/>
+      <entry name="deactivate" value="2" summary="deactivate request is available"/>
+      <entry name="remove" value="3" summary="remove request is available"/>
+      <entry name="rename" value="4" since="2" summary="rename request is available"/>
+      <entry name="set_tiling_state" value="5" since="2" summary="set_tiling_state request is available"/>
+    </enum>
+
+    <event name="capabilities">
+      <description summary="compositor capabilities">
+        This event advertises the capabilities supported by the compositor. If
+        a capability isn't supported, clients should hide or disable the UI
+        elements that expose this functionality. For instance, if the
+        compositor doesn't advertise support for removing workspaces, a button
+        triggering the remove request should not be displayed.
+
+        The compositor will ignore requests it doesn't support. For instance,
+        a compositor which doesn't advertise support for remove will ignore
+        remove requests.
+
+        Compositors must send this event once after creation of an
+        zcosmic_workspace_handle_v1 . When the capabilities change, compositors
+        must send this event again.
+
+        The capabilities are sent as an array of 32-bit unsigned integers in
+        native endianness.
+      </description>
+      <arg name="capabilities" type="array" summary="array of 32-bit capabilities"/>
+    </event>
+
+    <event name="remove">
+      <description summary="this workspace has been destroyed">
+        This event means the zcosmic_workspace_handle_v1 has been destroyed. It is
+        guaranteed there won't be any more events for this
+        zcosmic_workspace_handle_v1. The zext_workspace_handle_v1 becomes inert so
+        any requests will be ignored except the destroy request.
+      </description>
+    </event>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the zcosmic_workspace_handle_v1 object">
+        Destroys the zcosmic_workspace_handle_v1 object.
+
+        This request should be called either when the client does not want to
+        use the workspace object any more or after the remove event to finalize
+        the destruction of the object.
+      </description>
+    </request>
+
+    <request name="activate">
+      <description summary="activate the workspace">
+        Request that this workspace be activated.
+
+        There is no guarantee the workspace will be actually activated, and
+        behaviour may be compositor-dependent. For example, activating a
+        workspace may or may not deactivate all other workspaces in the same
+        group.
+      </description>
+    </request>
+
+    <request name="deactivate">
+      <description summary="activate the workspace">
+        Request that this workspace be deactivated.
+
+        There is no guarantee the workspace will be actually deactivated.
+      </description>
+    </request>
+
+    <request name="remove">
+      <description summary="remove the workspace">
+        Request that this workspace be removed.
+
+        There is no guarantee the workspace will be actually removed.
+      </description>
+    </request>
+
+    <event name="tiling_state" since="2">
+      <description summary="indicates if tiling behavior is enabled for this workspace">
+        This event is emitted immediately after the zcosmic_workspace_handle_v1 is created
+        and each time the workspace tiling state changes, either because of a
+        compositor action or because of a request in this protocol.
+      </description>
+      <arg name="state" type="uint" enum="tiling_state"/>
+    </event>
+
+    <enum name="tiling_state" since="2">
+      <description summary="types of tiling state a workspace may have"/>
+
+      <entry name="floating_only" value="0" summary="The workspace has no active tiling properties"/>
+      <entry name="tiling_enabled" value="1" summary="Tiling behavior is enabled for the workspace"/>
+    </enum>
+
+    <request name="rename" since="2">
+      <description summary="rename this workspace">
+        Request that this workspace is renamed.
+
+        There is no guarantee the workspace will actually be renamed.
+      </description>
+      <arg name="name" type="string" summary="new name of the workspace"/>
+    </request>
+
+    <request name="set_tiling_state" since="2">
+      <description summary="change the tiling state of this workspace">
+        Request that this workspace's tiling state is changed.
+
+        There is no guarantee the workspace will actually change it's tiling state.
+      </description>
+      <arg name="state" type="uint" enum="tiling_state" summary="the new tiling state of the workspace"/>
+    </request>
+  </interface>
+</protocol>

+ 219 - 0
protocols/ext-foreign-toplevel-list-v1.xml

@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="ext_foreign_toplevel_list_v1">
+  <copyright>
+    Copyright © 2018 Ilia Bozhinov
+    Copyright © 2020 Isaac Freund
+    Copyright © 2022 wb9688
+    Copyright © 2023 i509VCB
+
+    Permission to use, copy, modify, distribute, and sell this
+    software and its documentation for any purpose is hereby granted
+    without fee, provided that the above copyright notice appear in
+    all copies and that both that copyright notice and this permission
+    notice appear in supporting documentation, and that the name of
+    the copyright holders not be used in advertising or publicity
+    pertaining to distribution of the software without specific,
+    written prior permission.  The copyright holders make no
+    representations about the suitability of this software for any
+    purpose.  It is provided "as is" without express or implied
+    warranty.
+
+    THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+    SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+    FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+    SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+    AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+    THIS SOFTWARE.
+  </copyright>
+
+  <description summary="list toplevels">
+    The purpose of this protocol is to provide protocol object handles for
+    toplevels, possibly originating from another client.
+
+    This protocol is intentionally minimalistic and expects additional
+    functionality (e.g. creating a screencopy source from a toplevel handle,
+    getting information about the state of the toplevel) to be implemented
+    in extension protocols.
+
+    The compositor may choose to restrict this protocol to a special client
+    launched by the compositor itself or expose it to all clients,
+    this is compositor policy.
+
+    The key words "must", "must not", "required", "shall", "shall not",
+    "should", "should not", "recommended",  "may", and "optional" in this
+    document are to be interpreted as described in IETF RFC 2119.
+
+    Warning! The protocol described in this file is currently in the testing
+    phase. Backward compatible changes may be added together with the
+    corresponding interface version bump. Backward incompatible changes can
+    only be done by creating a new major version of the extension.
+  </description>
+
+  <interface name="ext_foreign_toplevel_list_v1" version="1">
+    <description summary="list toplevels">
+      A toplevel is defined as a surface with a role similar to xdg_toplevel.
+      XWayland surfaces may be treated like toplevels in this protocol.
+
+      After a client binds the ext_foreign_toplevel_list_v1, each mapped
+      toplevel window will be sent using the ext_foreign_toplevel_list_v1.toplevel
+      event.
+
+      Clients which only care about the current state can perform a roundtrip after
+      binding this global.
+
+      For each instance of ext_foreign_toplevel_list_v1, the compositor must
+      create a new ext_foreign_toplevel_handle_v1 object for each mapped toplevel.
+
+      If a compositor implementation sends the ext_foreign_toplevel_list_v1.finished
+      event after the global is bound, the compositor must not send any
+      ext_foreign_toplevel_list_v1.toplevel events.
+    </description>
+
+    <event name="toplevel">
+      <description summary="a toplevel has been created">
+        This event is emitted whenever a new toplevel window is created. It is
+        emitted for all toplevels, regardless of the app that has created them.
+
+        All initial properties of the toplevel (identifier, title, app_id) will be sent
+        immediately after this event using the corresponding events for
+        ext_foreign_toplevel_handle_v1. The compositor will use the
+        ext_foreign_toplevel_handle_v1.done event to indicate when all data has
+        been sent.
+      </description>
+      <arg name="toplevel" type="new_id" interface="ext_foreign_toplevel_handle_v1"/>
+    </event>
+
+    <event name="finished">
+      <description summary="the compositor has finished with the toplevel manager">
+        This event indicates that the compositor is done sending events
+        to this object. The client should destroy the object.
+        See ext_foreign_toplevel_list_v1.destroy for more information.
+
+        The compositor must not send any more toplevel events after this event.
+      </description>
+    </event>
+
+    <request name="stop">
+      <description summary="stop sending events">
+        This request indicates that the client no longer wishes to receive
+        events for new toplevels.
+
+        The Wayland protocol is asynchronous, meaning the compositor may send
+        further toplevel events until the stop request is processed.
+        The client should wait for a ext_foreign_toplevel_list_v1.finished
+        event before destroying this object.
+      </description>
+    </request>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the ext_foreign_toplevel_list_v1 object">
+        This request should be called either when the client will no longer
+        use the ext_foreign_toplevel_list_v1 or after the finished event
+        has been received to allow destruction of the object.
+
+        If a client wishes to destroy this object it should send a
+        ext_foreign_toplevel_list_v1.stop request and wait for a ext_foreign_toplevel_list_v1.finished
+        event, then destroy the handles and then this object.
+      </description>
+    </request>
+  </interface>
+
+  <interface name="ext_foreign_toplevel_handle_v1" version="1">
+    <description summary="a mapped toplevel">
+      A ext_foreign_toplevel_handle_v1 object represents a mapped toplevel
+      window. A single app may have multiple mapped toplevels.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the ext_foreign_toplevel_handle_v1 object">
+        This request should be used when the client will no longer use the handle
+        or after the closed event has been received to allow destruction of the
+        object.
+
+        When a handle is destroyed, a new handle may not be created by the server
+        until the toplevel is unmapped and then remapped. Destroying a toplevel handle
+        is not recommended unless the client is cleaning up child objects
+        before destroying the ext_foreign_toplevel_list_v1 object, the toplevel
+        was closed or the toplevel handle will not be used in the future.
+
+        Other protocols which extend the ext_foreign_toplevel_handle_v1
+        interface should require destructors for extension interfaces be
+        called before allowing the toplevel handle to be destroyed.
+      </description>
+    </request>
+
+    <event name="closed">
+      <description summary="the toplevel has been closed">
+        The server will emit no further events on the ext_foreign_toplevel_handle_v1
+        after this event. Any requests received aside from the destroy request must
+        be ignored. Upon receiving this event, the client should destroy the handle.
+
+        Other protocols which extend the ext_foreign_toplevel_handle_v1
+        interface must also ignore requests other than destructors.
+      </description>
+    </event>
+
+    <event name="done">
+      <description summary="all information about the toplevel has been sent">
+        This event is sent after all changes in the toplevel state have
+        been sent.
+
+        This allows changes to the ext_foreign_toplevel_handle_v1 properties
+        to be atomically applied. Other protocols which extend the
+        ext_foreign_toplevel_handle_v1 interface may use this event to also
+        atomically apply any pending state.
+
+        This event must not be sent after the ext_foreign_toplevel_handle_v1.closed
+        event.
+      </description>
+    </event>
+
+    <event name="title">
+      <description summary="title change">
+        The title of the toplevel has changed.
+
+        The configured state must not be applied immediately. See
+        ext_foreign_toplevel_handle_v1.done for details.
+      </description>
+      <arg name="title" type="string"/>
+    </event>
+
+    <event name="app_id">
+      <description summary="app_id change">
+        The app id of the toplevel has changed.
+
+        The configured state must not be applied immediately. See
+        ext_foreign_toplevel_handle_v1.done for details.
+      </description>
+      <arg name="app_id" type="string"/>
+    </event>
+
+    <event name="identifier">
+      <description summary="a stable identifier for a toplevel">
+        This identifier is used to check if two or more toplevel handles belong
+        to the same toplevel.
+
+        The identifier is useful for command line tools or privileged clients
+        which may need to reference an exact toplevel across processes or
+        instances of the ext_foreign_toplevel_list_v1 global.
+
+        The compositor must only send this event when the handle is created.
+
+        The identifier must be unique per toplevel and its handles. Two different
+        toplevels must not have the same identifier. The identifier is only valid
+        as long as the toplevel is mapped. If the toplevel is unmapped the identifier
+        must not be reused. An identifier must not be reused by the compositor to
+        ensure there are no races when sharing identifiers between processes.
+
+        An identifier is a string that contains up to 32 printable ASCII bytes.
+        An identifier must not be an empty string. It is recommended that a
+        compositor includes an opaque generation value in identifiers. How the
+        generation value is used when generating the identifier is implementation
+        dependent.
+      </description>
+      <arg name="identifier" type="string"/>
+    </event>
+  </interface>
+</protocol>

+ 422 - 0
protocols/ext-workspace-v1.xml

@@ -0,0 +1,422 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="ext_workspace_v1">
+  <copyright>
+    Copyright © 2019 Christopher Billington
+    Copyright © 2020 Ilia Bozhinov
+    Copyright © 2022 Victoria Brekenfeld
+
+    Permission to use, copy, modify, distribute, and sell this
+    software and its documentation for any purpose is hereby granted
+    without fee, provided that the above copyright notice appear in
+    all copies and that both that copyright notice and this permission
+    notice appear in supporting documentation, and that the name of
+    the copyright holders not be used in advertising or publicity
+    pertaining to distribution of the software without specific,
+    written prior permission.  The copyright holders make no
+    representations about the suitability of this software for any
+    purpose.  It is provided "as is" without express or implied
+    warranty.
+
+    THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+    SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+    FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+    SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+    AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+    THIS SOFTWARE.
+  </copyright>
+
+  <interface name="ext_workspace_manager_v1" version="1">
+    <description summary="list and control workspaces">
+      Workspaces, also called virtual desktops, are groups of surfaces. A
+      compositor with a concept of workspaces may only show some such groups of
+      surfaces (those of 'active' workspaces) at a time. 'Activating' a
+      workspace is a request for the compositor to display that workspace's
+      surfaces as normal, whereas the compositor may hide or otherwise
+      de-emphasise surfaces that are associated only with 'inactive' workspaces.
+      Workspaces are grouped by which sets of outputs they correspond to, and
+      may contain surfaces only from those outputs. In this way, it is possible
+      for each output to have its own set of workspaces, or for all outputs (or
+      any other arbitrary grouping) to share workspaces. Compositors may
+      optionally conceptually arrange each group of workspaces in an
+      N-dimensional grid.
+
+      The purpose of this protocol is to enable the creation of taskbars and
+      docks by providing them with a list of workspaces and their properties,
+      and allowing them to activate and deactivate workspaces.
+
+      After a client binds the ext_workspace_manager_v1, each workspace will be
+      sent via the workspace event.
+    </description>
+
+    <event name="workspace_group">
+      <description summary="a workspace group has been created">
+        This event is emitted whenever a new workspace group has been created.
+
+        All initial details of the workspace group (outputs) will be
+        sent immediately after this event via the corresponding events in
+        ext_workspace_group_handle_v1 and ext_workspace_handle_v1.
+      </description>
+      <arg name="workspace_group" type="new_id" interface="ext_workspace_group_handle_v1"/>
+    </event>
+
+    <event name="workspace">
+      <description summary="workspace has been created">
+        This event is emitted whenever a new workspace has been created.
+
+        All initial details of the workspace (name, coordinates, state) will
+        be sent immediately after this event via the corresponding events in
+        ext_workspace_handle_v1.
+
+        Workspaces start off unassigned to any workspace group.
+      </description>
+      <arg name="workspace" type="new_id" interface="ext_workspace_handle_v1"/>
+    </event>
+  
+    <request name="commit">
+      <description summary="all requests about the workspaces have been sent">
+        The client must send this request after it has finished sending other
+        requests. The compositor must process a series of requests preceding a
+        commit request atomically.
+
+        This allows changes to the workspace properties to be seen as atomic,
+        even if they happen via multiple events, and even if they involve
+        multiple ext_workspace_handle_v1 objects, for example, deactivating one
+        workspace and activating another.
+      </description>
+    </request>
+
+    <event name="done">
+      <description summary="all information about the workspaces and workspace groups has been sent">
+        This event is sent after all changes in all workspaces and workspace groups have been
+        sent.
+
+        This allows changes to one or more ext_workspace_group_handle_v1
+        properties and ext_workspace_handle_v1 properties
+        to be seen as atomic, even if they happen via multiple events.
+        In particular, an output moving from one workspace group to
+        another sends an output_enter event and an output_leave event to the two
+        ext_workspace_group_handle_v1 objects in question. The compositor sends
+        the done event only after updating the output information in both
+        workspace groups.
+      </description>
+    </event>
+
+    <event name="finished" type="destructor">
+      <description summary="the compositor has finished with the workspace_manager">
+        This event indicates that the compositor is done sending events to the
+        ext_workspace_manager_v1. The server will destroy the object
+        immediately after sending this request.
+      </description>
+    </event>
+
+    <request name="stop">
+      <description summary="stop sending events">
+        Indicates the client no longer wishes to receive events for new
+        workspace groups. However the compositor may emit further workspace
+        events, until the finished event is emitted. The compositor is expected
+        to send the finished event eventually once the stop request has been processed.
+
+        The client must not send any requests after this one, doing so will raise a wl_display
+        invalid_object error.
+      </description>
+    </request>
+
+  </interface>
+
+  <interface name="ext_workspace_group_handle_v1" version="1">
+    <description summary="a workspace group assigned to a set of outputs">
+      A ext_workspace_group_handle_v1 object represents a workspace group
+      that is assigned a set of outputs and contains a number of workspaces.
+
+      The set of outputs assigned to the workspace group is conveyed to the client via
+      output_enter and output_leave events, and its workspaces are conveyed with
+      workspace events.
+
+      For example, a compositor which has a set of workspaces for each output may
+      advertise a workspace group (and its workspaces) per output, whereas a compositor
+      where a workspace spans all outputs may advertise a single workspace group for all
+      outputs.
+    </description>
+
+    <enum name="group_capabilities" bitfield="true">
+      <entry name="create_workspace" value="1" summary="create_workspace request is available"/>
+    </enum>
+
+    <event name="capabilities">
+      <description summary="compositor capabilities">
+        This event advertises the capabilities supported by the compositor. If
+        a capability isn't supported, clients should hide or disable the UI
+        elements that expose this functionality. For instance, if the
+        compositor doesn't advertise support for creating workspaces, a button
+        triggering the create_workspace request should not be displayed.
+
+        The compositor will ignore requests it doesn't support. For instance,
+        a compositor which doesn't advertise support for creating workspaces will ignore
+        create_workspace requests.
+
+        Compositors must send this event once after creation of an
+        ext_workspace_group_handle_v1. When the capabilities change, compositors
+        must send this event again.
+      </description>
+      <arg name="capabilities" type="uint" summary="capabilities" enum="group_capabilities"/>
+    </event>
+
+    <event name="output_enter">
+      <description summary="output assigned to workspace group">
+        This event is emitted whenever an output is assigned to the workspace
+        group or a new `wl_output` object is bound by the client, which was already
+        assigned to this workspace_group.
+      </description>
+      <arg name="output" type="object" interface="wl_output"/>
+    </event>
+
+    <event name="output_leave">
+      <description summary="output removed from workspace group">
+        This event is emitted whenever an output is removed from the workspace
+        group.
+      </description>
+      <arg name="output" type="object" interface="wl_output"/>
+    </event>
+
+    <event name="workspace_enter">
+      <description summary="workspace added to workspace group">
+        This event is emitted whenever a workspace is assigned to this group.
+        A workspace may only ever be assigned to a single group at a single point
+        in time, but can be re-assigned during its lifetime.
+      </description>
+      <arg name="workspace" type="object" interface="ext_workspace_handle_v1"/>
+    </event>
+
+    <event name="workspace_leave">
+      <description summary="workspace removed from workspace group">
+        This event is emitted whenever a workspace is removed from this group.
+      </description>
+      <arg name="workspace" type="object" interface="ext_workspace_handle_v1"/>
+    </event>
+
+    <event name="removed">
+      <description summary="this workspace group has been removed">
+        This event is send when the group associated with the ext_workspace_group_handle_v1
+        has been removed. After sending this request the compositor will immediately consider
+        the object inert. Any requests will be ignored except the destroy request.
+        It is guaranteed there won't be any more events referencing this
+        ext_workspace_group_handle_v1.
+
+        The compositor must remove all workspaces belonging to a workspace group
+        via a workspace_leave event before removing the workspace group.
+      </description>
+    </event>
+
+    <request name="create_workspace">
+      <description summary="create a new workspace">
+        Request that the compositor create a new workspace with the given name
+        and assign it to this group.
+
+        There is no guarantee that the compositor will create a new workspace,
+        or that the created workspace will have the provided name.
+      </description>
+      <arg name="workspace" type="string"/>
+    </request>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the ext_workspace_group_handle_v1 object">
+        Destroys the ext_workspace_group_handle_v1 object.
+
+        This request should be send either when the client does not want to
+        use the workspace group object any more or after the removed event to finalize
+        the destruction of the object.
+      </description>
+    </request>
+  </interface>
+
+  <interface name="ext_workspace_handle_v1" version="1">
+    <description summary="a workspace handing a group of surfaces">
+      A ext_workspace_handle_v1 object represents a workspace that handles a
+      group of surfaces.
+
+      Each workspace has:
+      - a name, conveyed to the client with the name event
+      - potentially an id conveyed with the id event
+      - a list of states, conveyed to the client with the state event
+      - and optionally a set of coordinates, conveyed to the client with the
+      coordinates event
+      
+      The client may request that the compositor activate or deactivate the workspace.
+
+      Each workspace can belong to only a single workspace group.
+      Depending on the compositor policy, there might be workspaces with
+      the same name in different workspace groups, but these workspaces are still
+      separate (e.g. one of them might be active while the other is not).
+    </description>
+
+    <event name="id">
+      <description summary="workspace id">
+        If this event is emitted, it will be send immediately after the
+        ext_workspace_handle_v1 is created or when an id is assigned to
+        a workspace (at most once during its lifetime).
+
+        An id will never change during the lifetime of the `ext_workspace_handle_v1`
+        and is guaranteed to be unique during its lifetime.
+
+        Ids are not human-readable and shouldn't be displayed, use `name` for that purpose.
+
+        Compositors are expected to only send ids for workspaces likely stable across multiple
+        sessions and can be used by clients to store preferences for workspaces. Workspaces without
+        ids should be considered temporary and any data associated with them should be deleted once
+        the respective object is lost.
+      </description>
+      <arg name="id" type="string"/>
+    </event>
+
+    <event name="name">
+      <description summary="workspace name changed">
+        This event is emitted immediately after the ext_workspace_handle_v1 is
+        created and whenever the name of the workspace changes.
+
+        A name is meant to be human-readable and can be displayed to a user.
+        Unlike the id it is neither stable nor unique.
+      </description>
+      <arg name="name" type="string"/>
+    </event>
+
+    <event name="coordinates">
+      <description summary="workspace coordinates changed">
+        This event is used to organize workspaces into an N-dimensional grid
+        within a workspace group, and if supported, is emitted immediately after
+        the ext_workspace_handle_v1 is created and whenever the coordinates of
+        the workspace change. Compositors may not send this event if they do not
+        conceptually arrange workspaces in this way. If compositors simply
+        number workspaces, without any geometric interpretation, they may send
+        1D coordinates, which clients should not interpret as implying any
+        geometry. Sending an empty array means that the compositor no longer
+        orders the workspace geometrically.
+
+        Coordinates have an arbitrary number of dimensions N with an uint32
+        position along each dimension. By convention if N > 1, the first
+        dimension is X, the second Y, the third Z, and so on. The compositor may
+        chose to utilize these events for a more novel workspace layout
+        convention, however. No guarantee is made about the grid being filled or
+        bounded; there may be a workspace at coordinate 1 and another at
+        coordinate 1000 and none in between. Within a workspace group, however,
+        workspaces must have unique coordinates of equal dimensionality.
+      </description>
+      <arg name="coordinates" type="array"/>
+    </event>
+
+    <enum name="state" bitfield="true">
+      <description summary="types of states on the workspace">
+        The different states that a workspace can have.
+      </description>
+
+      <entry name="active" value="1" summary="the workspace is active"/>
+      <entry name="urgent" value="2" summary="the workspace requests attention"/>
+      <entry name="hidden" value="4">
+        <description summary="the workspace is not visible">
+          The workspace is not visible in its workspace group, and clients
+          attempting to visualize the compositor workspace state should not
+          display such workspaces.
+        </description>
+      </entry>
+    </enum>
+
+    <event name="state">
+      <description summary="the state of the workspace changed">
+        This event is emitted immediately after the ext_workspace_handle_v1 is
+        created and each time the workspace state changes, either because of a
+        compositor action or because of a request in this protocol.
+
+        Missing states convey the opposite meaning, e.g. an unset active bit
+        means the workspace is currently inactive.
+      </description>
+      <arg name="state" type="uint" enum="state"/>
+    </event>
+
+    <enum name="workspace_capabilities" bitfield="true">
+      <entry name="activate" value="1" summary="activate request is available"/>
+      <entry name="deactivate" value="2" summary="deactivate request is available"/>
+      <entry name="remove" value="4" summary="remove request is available"/>
+      <entry name="assign" value="8" summary="assign request is available"/>
+    </enum>
+
+    <event name="capabilities">
+      <description summary="compositor capabilities">
+        This event advertises the capabilities supported by the compositor. If
+        a capability isn't supported, clients should hide or disable the UI
+        elements that expose this functionality. For instance, if the
+        compositor doesn't advertise support for removing workspaces, a button
+        triggering the remove request should not be displayed.
+
+        The compositor will ignore requests it doesn't support. For instance,
+        a compositor which doesn't advertise support for remove will ignore
+        remove requests.
+
+        Compositors must send this event once after creation of an
+        ext_workspace_handle_v1 . When the capabilities change, compositors
+        must send this event again.
+      </description>
+      <arg name="capabilities" type="uint" summary="capabilities" enum="workspace_capabilities"/>
+    </event>
+
+    <event name="removed">
+      <description summary="this workspace has been removed">
+        This event is send when the workspace associated with the ext_workspace_handle_v1
+        has been removed. After sending this request, the compositor will immediately consider
+        the object inert. Any requests will be ignored except the destroy request.
+
+        It is guaranteed there won't be any more events referencing this
+        ext_workspace_handle_v1.
+
+        The compositor must only remove a workspaces not currently belonging to any
+        workspace_group.
+      </description>
+    </event>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the ext_workspace_handle_v1 object">
+        Destroys the ext_workspace_handle_v1 object.
+
+        This request should be made either when the client does not want to
+        use the workspace object any more or after the remove event to finalize
+        the destruction of the object.
+      </description>
+    </request>
+
+    <request name="activate">
+      <description summary="activate the workspace">
+        Request that this workspace be activated.
+
+        There is no guarantee the workspace will be actually activated, and
+        behaviour may be compositor-dependent. For example, activating a
+        workspace may or may not deactivate all other workspaces in the same
+        group.
+      </description>
+    </request>
+
+    <request name="deactivate">
+      <description summary="deactivate the workspace">
+        Request that this workspace be deactivated.
+
+        There is no guarantee the workspace will be actually deactivated.
+      </description>
+    </request>
+
+    <request name="assign">
+      <description summary="assign workspace to group">
+        Requests that this workspace is assigned to the given workspace group.
+
+        There is no guarantee the workspace will be assigned.
+      </description>
+      <arg name="workspace_group" type="object" interface="ext_workspace_group_handle_v1"/>
+    </request>
+
+    <request name="remove">
+      <description summary="remove the workspace">
+        Request that this workspace be removed.
+
+        There is no guarantee the workspace will be actually removed.
+      </description>
+    </request>
+  </interface>
+</protocol>

+ 1 - 1
src/WallpaperEngine/Render/AlbumTexture.cpp

@@ -51,7 +51,7 @@ void AlbumTexture::copyContents (const TextureProvider& other) const noexcept {
     uint8_t* buffer = new uint8_t[bufferSize];
 
     glBindTexture (GL_TEXTURE_2D, other.getTextureID (0));
-    glGetnTexImage (GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, bufferSize, buffer);
+    glGetTexImage (GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
 
     glBindTexture (GL_TEXTURE_2D, this->m_textureID);
     glTexImage2D (

+ 160 - 3
src/WallpaperEngine/Render/Drivers/Detectors/WaylandFullScreenDetector.cpp

@@ -11,6 +11,8 @@
 #include "WallpaperEngine/Logging/Log.h"
 #include "WallpaperEngine/Render/Drivers/VideoFactories.h"
 #include "WallpaperEngine/Render/Drivers/WaylandOpenGLDriver.h"
+#include "cosmic-toplevel-info-unstable-v1-protocol.h"
+#include "ext-foreign-toplevel-list-v1-protocol.h"
 #include "wlr-foreign-toplevel-management-unstable-v1-protocol.h"
 #include <algorithm>
 #include <cstring>
@@ -124,6 +126,122 @@ namespace {
 	.finished = managerFinished,
     };
 
+    // COSMIC: the ext handle names the window (app id, closed), the cosmic extension object made from it has the outputs
+    // and the state
+    void foreignClosed (void* data, ext_foreign_toplevel_handle_v1*) {
+	const auto toplevel = static_cast<Toplevel*> (data);
+	toplevel->detector->removeToplevel (toplevel);
+    }
+
+    void foreignDone (void*, ext_foreign_toplevel_handle_v1*) { }
+
+    void foreignTitle (void*, ext_foreign_toplevel_handle_v1*, const char*) { }
+
+    void foreignAppId (void* data, ext_foreign_toplevel_handle_v1*, const char* appId) {
+	if (appId) {
+	    static_cast<Toplevel*> (data)->appId = appId;
+	}
+    }
+
+    void foreignIdentifier (void*, ext_foreign_toplevel_handle_v1*, const char*) { }
+
+    constexpr ext_foreign_toplevel_handle_v1_listener foreignHandleListener = {
+	.closed = foreignClosed,
+	.done = foreignDone,
+	.title = foreignTitle,
+	.app_id = foreignAppId,
+	.identifier = foreignIdentifier,
+    };
+
+    void cosmicClosed (void*, zcosmic_toplevel_handle_v1*) { }
+
+    void cosmicDone (void*, zcosmic_toplevel_handle_v1*) { }
+
+    void cosmicTitle (void*, zcosmic_toplevel_handle_v1*, const char*) { }
+
+    void cosmicAppId (void*, zcosmic_toplevel_handle_v1*, const char*) { }
+
+    void cosmicOutputEnter (void* data, zcosmic_toplevel_handle_v1*, wl_output* output) {
+	static_cast<Toplevel*> (data)->outputs.insert (output);
+    }
+
+    void cosmicOutputLeave (void* data, zcosmic_toplevel_handle_v1*, wl_output* output) {
+	static_cast<Toplevel*> (data)->outputs.erase (output);
+    }
+
+    void cosmicWorkspace (void*, zcosmic_toplevel_handle_v1*, zcosmic_workspace_handle_v1*) { }
+
+    void cosmicState (void* data, zcosmic_toplevel_handle_v1*, wl_array* state) {
+	const auto toplevel = static_cast<Toplevel*> (data);
+	const auto begin = static_cast<uint32_t*> (state->data);
+
+	toplevel->fullscreen = false;
+	toplevel->maximized = false;
+	toplevel->activated = false;
+	toplevel->minimized = false;
+
+	for (auto it = begin; it < begin + state->size / sizeof (uint32_t); ++it) {
+	    switch (*it) {
+		case ZCOSMIC_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN:
+		    toplevel->fullscreen = true;
+		    break;
+		case ZCOSMIC_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED:
+		    toplevel->maximized = true;
+		    break;
+		case ZCOSMIC_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED:
+		    toplevel->activated = true;
+		    break;
+		case ZCOSMIC_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED:
+		    toplevel->minimized = true;
+		    break;
+		default:
+		    break;
+	    }
+	}
+    }
+
+    void cosmicGeometry (void*, zcosmic_toplevel_handle_v1*, wl_output*, int32_t, int32_t, int32_t, int32_t) { }
+
+    void cosmicExtWorkspace (void*, zcosmic_toplevel_handle_v1*, ext_workspace_handle_v1*) { }
+
+    constexpr zcosmic_toplevel_handle_v1_listener cosmicHandleListener = {
+	.closed = cosmicClosed,
+	.done = cosmicDone,
+	.title = cosmicTitle,
+	.app_id = cosmicAppId,
+	.output_enter = cosmicOutputEnter,
+	.output_leave = cosmicOutputLeave,
+	.workspace_enter = cosmicWorkspace,
+	.workspace_leave = cosmicWorkspace,
+	.state = cosmicState,
+	.geometry = cosmicGeometry,
+	.ext_workspace_enter = cosmicExtWorkspace,
+	.ext_workspace_leave = cosmicExtWorkspace,
+    };
+
+    void foreignListToplevel (void* data, ext_foreign_toplevel_list_v1*, ext_foreign_toplevel_handle_v1* handle) {
+	static_cast<WaylandFullScreenDetector*> (data)->addForeignToplevel (handle);
+    }
+
+    void foreignListFinished (void*, ext_foreign_toplevel_list_v1*) { }
+
+    constexpr ext_foreign_toplevel_list_v1_listener foreignListListener = {
+	.toplevel = foreignListToplevel,
+	.finished = foreignListFinished,
+    };
+
+    void cosmicInfoToplevel (void*, zcosmic_toplevel_info_v1*, zcosmic_toplevel_handle_v1*) { }
+
+    void cosmicInfoFinished (void*, zcosmic_toplevel_info_v1*) { }
+
+    void cosmicInfoDone (void*, zcosmic_toplevel_info_v1*) { }
+
+    constexpr zcosmic_toplevel_info_v1_listener cosmicInfoListener = {
+	.toplevel = cosmicInfoToplevel,
+	.finished = cosmicInfoFinished,
+	.done = cosmicInfoDone,
+    };
+
     void registryGlobal (void* data, wl_registry* registry, uint32_t name, const char* interface, uint32_t version) {
 	const auto detector = static_cast<WaylandFullScreenDetector*> (data);
 
@@ -132,6 +250,11 @@ namespace {
 	} else if (strcmp (interface, zwlr_foreign_toplevel_manager_v1_interface.name) == 0) {
 	    detector->m_managerGlobal = name;
 	    detector->m_managerVersion = version;
+	} else if (strcmp (interface, zcosmic_toplevel_info_v1_interface.name) == 0) {
+	    detector->m_cosmicInfoGlobal = name;
+	    detector->m_cosmicInfoVersion = version;
+	} else if (strcmp (interface, ext_foreign_toplevel_list_v1_interface.name) == 0) {
+	    detector->m_foreignListGlobal = name;
 	}
     }
 
@@ -158,6 +281,21 @@ WaylandFullScreenDetector::WaylandFullScreenDetector (
     wl_registry_add_listener (m_registry, &registryListener, this);
     wl_display_roundtrip (m_display);
 
+    // COSMIC (cosmic-comp): version 2 of its toplevel info works on ext-foreign-toplevel-list handles
+    if (m_managerGlobal == 0 && m_cosmicInfoGlobal != 0 && m_cosmicInfoVersion >= 2 && m_foreignListGlobal != 0) {
+	m_cosmicInfo = static_cast<zcosmic_toplevel_info_v1*> (wl_registry_bind (
+	    m_registry, m_cosmicInfoGlobal, &zcosmic_toplevel_info_v1_interface, std::min<uint32_t> (m_cosmicInfoVersion, 3)
+	));
+	zcosmic_toplevel_info_v1_add_listener (m_cosmicInfo, &cosmicInfoListener, this);
+	m_foreignList = static_cast<ext_foreign_toplevel_list_v1*> (
+	    wl_registry_bind (m_registry, m_foreignListGlobal, &ext_foreign_toplevel_list_v1_interface, 1)
+	);
+	ext_foreign_toplevel_list_v1_add_listener (m_foreignList, &foreignListListener, this);
+	wl_display_roundtrip (m_display);
+	wl_display_roundtrip (m_display);
+	return;
+    }
+
     if (m_managerGlobal == 0) {
 	sLog.out ("Fullscreen detection not supported by your Wayland compositor");
 	return;
@@ -227,8 +365,27 @@ void WaylandFullScreenDetector::addToplevel (zwlr_foreign_toplevel_handle_v1* ha
     m_toplevels.push_back (toplevel);
 }
 
+void WaylandFullScreenDetector::addForeignToplevel (ext_foreign_toplevel_handle_v1* handle) {
+    const auto toplevel = new Toplevel { .detector = this, .foreign = handle };
+    ext_foreign_toplevel_handle_v1_add_listener (handle, &foreignHandleListener, toplevel);
+    toplevel->cosmic = zcosmic_toplevel_info_v1_get_cosmic_toplevel (m_cosmicInfo, handle);
+    zcosmic_toplevel_handle_v1_add_listener (toplevel->cosmic, &cosmicHandleListener, toplevel);
+    m_toplevels.push_back (toplevel);
+}
+
 void WaylandFullScreenDetector::removeToplevel (Toplevel* toplevel) {
-    zwlr_foreign_toplevel_handle_v1_destroy (toplevel->handle);
+    if (toplevel->handle) {
+	zwlr_foreign_toplevel_handle_v1_destroy (toplevel->handle);
+    }
+
+    if (toplevel->cosmic) {
+	zcosmic_toplevel_handle_v1_destroy (toplevel->cosmic);
+    }
+
+    if (toplevel->foreign) {
+	ext_foreign_toplevel_handle_v1_destroy (toplevel->foreign);
+    }
+
     std::erase (m_toplevels, toplevel);
     delete toplevel;
 }
@@ -252,7 +409,7 @@ std::vector<Desktop::WindowState> WaylandFullScreenDetector::windows (const std:
 	    | (toplevel->maximized && maximizedPauses ? Desktop::WindowState::Maximized : 0)
 	    | (toplevel->fullscreen ? Desktop::WindowState::Fullscreen : 0);
 
-	if (flags == 0) {
+	if (flags == 0 || toplevel->minimized) {
 	    continue;
 	}
 
@@ -276,7 +433,7 @@ std::vector<Desktop::WindowState> WaylandFullScreenDetector::windows (const std:
 }
 
 bool WaylandFullScreenDetector::anythingFullscreen () const {
-    if (!m_toplevelManager) {
+    if (!m_toplevelManager && !m_cosmicInfo) {
 	return false;
     }
 

+ 15 - 2
src/WallpaperEngine/Render/Drivers/Detectors/WaylandFullScreenDetector.h

@@ -14,6 +14,10 @@ struct wl_output;
 struct wl_registry;
 struct zwlr_foreign_toplevel_manager_v1;
 struct zwlr_foreign_toplevel_handle_v1;
+struct zcosmic_toplevel_info_v1;
+struct zcosmic_toplevel_handle_v1;
+struct ext_foreign_toplevel_list_v1;
+struct ext_foreign_toplevel_handle_v1;
 
 namespace WallpaperEngine::Render::Drivers {
 class WaylandOpenGLDriver;
@@ -25,7 +29,7 @@ struct WindowState;
 
 namespace WallpaperEngine::Render::Drivers::Detectors {
 
-// wlroots foreign toplevel: fullscreen (and with --pause-on-maximized maximized) windows pause their outputs, toplevels
+// wlroots foreign toplevel (COSMIC: ext-foreign-toplevel-list plus zcosmic_toplevel_info): fullscreen (and with --pause-on-maximized maximized) windows pause their outputs, toplevels
 // on unknown outputs count everywhere
 class WaylandFullScreenDetector final : public FullScreenDetector {
 public:
@@ -37,12 +41,15 @@ public:
 
     struct Toplevel {
 	WaylandFullScreenDetector* detector;
-	zwlr_foreign_toplevel_handle_v1* handle;
+	zwlr_foreign_toplevel_handle_v1* handle = nullptr;
+	zcosmic_toplevel_handle_v1* cosmic = nullptr;
+	ext_foreign_toplevel_handle_v1* foreign = nullptr;
 	std::string appId;
 	std::set<wl_output*> outputs;
 	bool fullscreen = false;
 	bool maximized = false;
 	bool activated = false;
+	bool minimized = false;
     };
 
     WaylandFullScreenDetector (Application::ApplicationContext& appContext, WaylandOpenGLDriver* driver);
@@ -56,17 +63,23 @@ public:
     void addOutput (wl_registry* registry, uint32_t globalName, uint32_t version);
     void removeGlobal (uint32_t globalName);
     void addToplevel (zwlr_foreign_toplevel_handle_v1* handle);
+    void addForeignToplevel (ext_foreign_toplevel_handle_v1* handle);
     void removeToplevel (Toplevel* toplevel);
     [[nodiscard]] const std::string* outputName (wl_output* output) const;
 
     uint32_t m_managerGlobal = 0;
     uint32_t m_managerVersion = 0;
+    uint32_t m_cosmicInfoGlobal = 0;
+    uint32_t m_cosmicInfoVersion = 0;
+    uint32_t m_foreignListGlobal = 0;
 
 private:
     WaylandOpenGLDriver* m_driver;
     wl_display* m_display = nullptr;
     wl_registry* m_registry = nullptr;
     zwlr_foreign_toplevel_manager_v1* m_toplevelManager = nullptr;
+    zcosmic_toplevel_info_v1* m_cosmicInfo = nullptr;
+    ext_foreign_toplevel_list_v1* m_foreignList = nullptr;
     std::vector<Output*> m_outputs;
     std::vector<Toplevel*> m_toplevels;
 };

+ 46 - 0
src/WallpaperEngine/Render/Drivers/GLFWOpenGLDriver.cpp

@@ -62,6 +62,8 @@ GLFWOpenGLDriver::GLFWOpenGLDriver (const char* windowTitle, ApplicationContext&
     if (context.settings.render.mode == ApplicationContext::EXPLICIT_WINDOW
 	|| context.settings.render.mode == ApplicationContext::NORMAL_WINDOW) {
 	m_output = new WallpaperEngine::Render::Drivers::Output::GLFWWindowOutput (context, *this);
+	this->m_offscreen = context.settings.render.mode == ApplicationContext::EXPLICIT_WINDOW
+	    && context.settings.render.window.asBackground && m_output->haveImageBuffer ();
     }
 #ifdef ENABLE_X11
     else {
@@ -75,6 +77,7 @@ GLFWOpenGLDriver::GLFWOpenGLDriver (const char* windowTitle, ApplicationContext&
 }
 
 GLFWOpenGLDriver::~GLFWOpenGLDriver () {
+    this->destroyOffscreenTarget ();
     delete this->m_output;
     glfwTerminate ();
 }
@@ -106,7 +109,46 @@ glm::ivec2 GLFWOpenGLDriver::getFramebufferSize () const {
 
 uint32_t GLFWOpenGLDriver::getFrameCounter () const { return this->m_frameCounter; }
 
+void GLFWOpenGLDriver::createOffscreenTarget (int width, int height) {
+    glGenTextures (1, &this->m_targetColor);
+    glBindTexture (GL_TEXTURE_2D, this->m_targetColor);
+    glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
+    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+    glBindTexture (GL_TEXTURE_2D, 0);
+
+    glGenFramebuffers (1, &this->m_targetFramebuffer);
+    glBindFramebuffer (GL_FRAMEBUFFER, this->m_targetFramebuffer);
+    glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, this->m_targetColor, 0);
+
+    if (glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
+	sLog.error ("The offscreen target of the background window is incomplete, reading the window itself");
+	this->destroyOffscreenTarget ();
+	this->m_offscreen = false;
+    }
+
+    glBindFramebuffer (GL_FRAMEBUFFER, 0);
+}
+
+void GLFWOpenGLDriver::destroyOffscreenTarget () {
+    if (this->m_targetFramebuffer != 0) {
+	glDeleteFramebuffers (1, &this->m_targetFramebuffer);
+	this->m_targetFramebuffer = 0;
+    }
+
+    if (this->m_targetColor != 0) {
+	glDeleteTextures (1, &this->m_targetColor);
+	this->m_targetColor = 0;
+    }
+}
+
 void GLFWOpenGLDriver::dispatchEventQueue () {
+    if (this->m_offscreen && this->m_targetFramebuffer == 0) {
+	this->createOffscreenTarget (this->m_output->getFullWidth (), this->m_output->getFullHeight ());
+	this->getApp ().setDestinationFramebuffer (this->m_targetFramebuffer);
+    }
+
+    glBindFramebuffer (GL_FRAMEBUFFER, this->m_targetFramebuffer);
     glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
     for (const auto& [screen, viewport] : this->m_output->getViewports ()) {
@@ -114,6 +156,8 @@ void GLFWOpenGLDriver::dispatchEventQueue () {
     }
 
     if (this->m_output->haveImageBuffer ()) {
+	glBindFramebuffer (GL_READ_FRAMEBUFFER, this->m_targetFramebuffer);
+
 	// glReadnPixels requires GL 4.5; older drivers fall back to glReadPixels
 	if (GLEW_VERSION_4_5) {
 	    glReadnPixels (
@@ -134,6 +178,8 @@ void GLFWOpenGLDriver::dispatchEventQueue () {
 	}
     }
 
+    glBindFramebuffer (GL_FRAMEBUFFER, 0);
+
     this->m_output->updateRender ();
     glfwSwapBuffers (this->m_window);
     glfwPollEvents ();

+ 7 - 0
src/WallpaperEngine/Render/Drivers/GLFWOpenGLDriver.h

@@ -37,9 +37,16 @@ public:
     GLFWwindow* getWindow () const;
 
 private:
+    void createOffscreenTarget (int width, int height);
+    void destroyOffscreenTarget ();
+
     Input::Drivers::GLFWMouseInput m_mouseInput;
     Output::Output* m_output = nullptr;
     GLFWwindow* m_window = nullptr;
     uint32_t m_frameCounter = 0;
+    // the window of --window-background is never shown, its own surface is not a safe place to read pixels from
+    bool m_offscreen = false;
+    GLuint m_targetFramebuffer = 0;
+    GLuint m_targetColor = 0;
 };
 }

+ 27 - 0
src/WallpaperEngine/Render/Drivers/Output/GLFWWindowOutput.cpp

@@ -150,6 +150,12 @@ void GLFWWindowOutput::createBackgroundWindow () {
 
     XMapWindow (display, window);
     XFlush (display);
+
+    sLog.out (
+	"Background window 0x", std::hex, window, std::dec, " ", geometry.z, "x", geometry.w, "+", geometry.x, "+",
+	geometry.y, ", screen depth ", DefaultDepth (display, screen), ", compositor ",
+	XGetSelectionOwner (display, atom ("_NET_WM_CM_S0")) != None ? "running" : "not running"
+    );
 }
 
 void GLFWWindowOutput::destroyBackgroundWindow () {
@@ -286,6 +292,20 @@ void GLFWWindowOutput::keepBackgroundWindowLow () const {
     this->m_nudgeUntil = tick + 6;
 }
 
+bool GLFWWindowOutput::frameIsBlack () const {
+    const auto* pixels = reinterpret_cast<const uint32_t*> (this->m_imageData);
+    const size_t count = this->m_imageSize / 4;
+
+    // every 97th pixel is plenty, a wallpaper that is black there is black
+    for (size_t i = 0; i < count; i += 97) {
+	if ((pixels[i] & 0x00FFFFFF) != 0) {
+	    return false;
+	}
+    }
+
+    return true;
+}
+
 bool GLFWWindowOutput::renderVFlip () const { return this->m_image == nullptr; }
 
 bool GLFWWindowOutput::renderMultiple () const { return false; }
@@ -312,6 +332,13 @@ void GLFWWindowOutput::updateRender () const {
 
     auto* display = static_cast<Display*> (this->m_display);
 
+    if (this->m_updates == 90 && this->frameIsBlack ()) {
+	sLog.error (
+	    "The background window got 90 frames and every pixel is black. Either the wallpaper is black or the frames "
+	    "never reach the window; the line above names the window to look for with xwininfo"
+	);
+    }
+
     XPutImage (
 	display, this->m_background, static_cast<GC> (this->m_gc), static_cast<XImage*> (this->m_image), 0, 0, 0, 0,
 	this->m_fullWidth, this->m_fullHeight

+ 1 - 0
src/WallpaperEngine/Render/Drivers/Output/GLFWWindowOutput.h

@@ -23,6 +23,7 @@ private:
     void destroyBackgroundWindow ();
     void keepBackgroundWindowLow () const;
     bool desktopWindowBelowUs () const;
+    bool frameIsBlack () const;
 
     // --window-background: the frames go into a plain X window of our own, see createBackgroundWindow
     // Xlib types are kept out of this header, its macros clash with the rest of the engine

+ 1 - 0
tools/linuxvm/.gitignore

@@ -0,0 +1 @@
+reports/

+ 49 - 26
tools/linuxvm/RELEASE_TESTING.md

@@ -19,11 +19,12 @@ particles (1120596121), one video, one preset, two web items (1078208425, 834237
 | ubuntu-gnome | GNOME Wayland | distribution + .deb we_manager | polkit install/update dialog |
 | arch-hypr | Hyprland | portable + AUR packages | layer shell, per-output pause |
 | mint-cinnamon | Cinnamon X11 | portable | `--window-background` (icons above, below windows, sticky), root mode |
-| debian-gnome | GNOME Wayland | portable | |
-| opensuse-tumbleweed-kde | Plasma Wayland | portable | newest libraries |
-| manjaro-kde | Plasma Wayland | portable + AUR | |
-| popos-cosmic | COSMIC | portable | layer shell on cosmic-comp |
-| bazzite | KDE/Gamescope, immutable | portable + Flatpak | rpm-ostree path of we_manager |
+| debian-gnome | GNOME Wayland | portable + .deb + Flatpak | maximized + fullscreen pause, apt dependency install |
+| opensuse-kde | Plasma Wayland | portable | newest libraries, zypper dependency install, maximized pause |
+| opensuse-xfce | XFCE X11 | portable | PulseAudio only desktop (no libpipewire), covered root window, zypper dependency install |
+| manjaro-kde | Plasma Wayland | portable | pacman dependency install (needs a fully updated system) |
+| popos-cosmic | COSMIC | portable + .deb | layer shell and window states (`zcosmic_toplevel_info`) on cosmic-comp |
+| bazzite | KDE, immutable | portable + Flatpak | rpm-ostree: dependency install refused, Flatpak |
 
 Rows are added as the VMs of `TODO.md` -> "Real-session distro VMs" get built. A new distro joins the matrix once its
 VM has a profile and a golden snapshot.
@@ -44,16 +45,29 @@ of the same wallpaper from `~/.local/share/we_live/refs` or the previous run, to
 icons/panel are still visible where the profile says they must be. A run fails on: engine exit or crash (core, `SIGSEGV`
 in the log), missing frames, black desktop, a leftover process, a log line matching the error list in the profile.
 
-## Automation to build
-
-- `tools/linuxvm/profiles/<vm>.sh`: how to reach the session (env vars for `DISPLAY`/`WAYLAND_DISPLAY`/dbus), the
-  screenshot command, how to install the candidate, which extra checks apply.
-- `tools/linuxvm/release_check.sh [--vm name ...] [--candidate dir]`: loops over the profiles sequentially (RAM, 30 GB,
-  fits one or two VMs), runs `guest_test.sh` in each over ssh, then writes `reports/<date>/summary.md` plus the
-  screenshots and logs, exit code 1 when anything failed.
-- `tools/linuxvm/guest_test.sh`: the per-VM steps above, prints one `PASS/FAIL <check>` line each.
-- `tools/linuxvm/check_frame.py`: black/flat/upside-down/reference comparison (Pillow, run with `-I`).
-- Retry a failed check once before calling it a failure (first-frame timing in VMs is noisy).
+## Automation
+
+All of it lives in `tools/linuxvm/`:
+
+- `profiles/<vm>.sh`: how to reach the session (`SCREEN`, `SHOT_CMD`, `FULLSCREEN_CMD`, `MAXIMIZE_CMD`, `WEM`, `WEM_FLAGS`,
+  `PREP`, `LOGIN_PASSWORD` for greeters without autologin). Written for the VMs above, the older VMs (fedora, ubuntu, arch,
+  mint) still need theirs checked.
+- `linuxvm.sh golden <vm>` / `fresh <vm>`: the VM's disk is frozen as `golden.qcow2` and runs on a throwaway overlay, `fresh`
+  throws the overlay away. Done for debian-gnome, opensuse-kde, opensuse-xfce, popos-cosmic, bazzite and manjaro-kde.
+- `release_check.sh [--vm name]... [--candidate dir] [--app dir|.deb] [--engine-tarball tgz]`: loops over the profiles
+  sequentially, writes `reports/<date>/summary.md` with screenshots and logs per VM, retries the failed checks once,
+  powers the VM off (ssh `systemctl poweroff`, ACPI does not reach a locked KDE session) and resets the overlay.
+- `guest_test.sh` (one PASS/FAIL/SKIP line per check; BEHAVIOR=1 adds hotswap, fullscreen and maximized pause through
+  `pause_check`, SIGKILL cleanup), `run_behavior.sh` (the same by hand), `host_shots.sh` (screenshots through the VM's
+  display, and a click on the screen centre so a test window gets the focus), `check_frame.py` (black/flat/unchanged/
+  hotswap differs, Pillow, run with `-I`).
+- `wem_check.sh` (we_manager install, launch, stop, kill all, autostart entry), `update_check.sh` (`fake_github.py` serving a
+  newer app .deb, `bump_deb.py`, and the candidate engine as a newer release), `deps_check.sh` (the "install build
+  dependencies" button on the VM's package manager, then the engine's CMake configure on the source tarball),
+  `autostart_check.sh` (a one wallpaper autostart playlist, a real reboot, we_manager and the engine back; wallpapers only
+  come back through the autostart playlist, a wallpaper launched by hand is not restored), `flatpak_check.sh` (bundle install,
+  scene + web wallpaper, stop, kill all, autostart entry).
+- Still open: reference frames per wallpaper in `check_frame.py` (upside down, wrong crop), profiles for the older VMs.
 
 ## Running it
 
@@ -63,17 +77,26 @@ and re-tag on my own: the report goes to the maintainer first. Cleanup after a r
 
 ## State (2026-10-19)
 
-Written and used on the five new VMs: `guest_test.sh` (engine per wallpaper: running, no crash text, screenshot, stops on
-SIGTERM, no web helper left), `check_frame.py --baseline` (compares with the desktop without a wallpaper), `sessenv.sh`
-(session variables from a desktop process), `host_shots.sh` (screenshots through the VM's display, for COSMIC). Not written
-yet: the per-VM profiles, golden snapshots with throwaway overlays, and `release_check.sh` that loops over all VMs.
-Per VM notes: KDE VMs need screen lock and sleep disabled plus `kde-inhibit` at login; Bazzite's /home is /var/home;
-Debian's cloud image needs the regular kernel for Wayland; GNOME needs its extension enabled and one relogin.
+Built and used: everything under "Automation". Golden disks and profiles exist for debian-gnome, debian-xfce, opensuse-kde,
+opensuse-xfce, opensuse-leap, manjaro-kde, arch-xfce (Arch with XFCE, stands in for EndeavourOS), popos-cosmic and bazzite.
+fedora-kde, fedora-gnome and ubuntu-gnome have draft profiles that were not run through `release_check.sh`, arch-hypr and
+mint-cinnamon have none yet. Per VM notes: KDE VMs need screen lock and sleep disabled (`kde-inhibit`, in the profile's
+PREP), Bazzite's /home is /var/home, Debian's cloud image needs the regular kernel for any graphics, GNOME needs its extension
+enabled and one relogin, Bazzite, Leap and COSMIC stop at a greeter (LOGIN_PASSWORD), the COSMIC VM needs
+`--disable-gpu-compositing` for we_manager.
+
+Pitfalls found while writing it: a locked or sleeping screen makes every picture identical, leftover test windows keep the
+engine paused (a paused engine does not read hotswap requests), the engine's command line shows /var/home on Fedora Atomic
+systems, `pkill -f` patterns match the ssh command that carries them (use `pkill -x`), the remote login shell can be zsh (an
+unmatched glob aborts the command), two runs on one VM disturb each other, a GNOME fullscreen window only counts when it has
+the focus (host_shots.sh clicks it), we_manager's library scan skips symlinked folders, an autostarted we_manager only
+brings wallpapers back through its autostart playlist, one or two VMs fit in RAM at a time (8 GB each).
 
 ## Order of work
 
-1. Finish the first batch of VMs (Debian GNOME, openSUSE Tumbleweed KDE, Manjaro KDE, Pop!_OS COSMIC, Bazzite).
-2. Give every VM a profile and a golden snapshot, starting with the five that exist.
-3. Write `guest_test.sh`, `check_frame.py` and the driver, prove them on Mint and Fedora KDE.
-4. Run the full matrix on the current build, fix what it finds, keep that report as the baseline for comparisons.
-5. Remaining distros from the TODO join the matrix one by one.
+1. Profiles for fedora-kde, fedora-gnome, ubuntu-gnome, arch-hypr and mint-cinnamon, golden disks, and `release_check.sh` runs
+   of them.
+2. Run the whole matrix on the committed build, fix what it finds, keep that report as the baseline for comparisons
+   (reference frames per wallpaper for `check_frame.py` first).
+3. Remaining distros from the TODO (CachyOS, SteamOS, Zorin, Manjaro XFCE, Garuda, ChimeraOS, elementary, MX; installer
+   ISOs, no cloud images) join the matrix one by one.

+ 55 - 0
tools/linuxvm/autostart_check.sh

@@ -0,0 +1,55 @@
+#!/bin/bash
+# autostart_check.sh <vm> <app dir | installed> [screen] - the autostart of we_manager across a real reboot: makes a
+# one wallpaper playlist through the running we_manager (DevTools, like wem_check.sh), sets it as the autostart playlist, reboots the VM and waits
+# for the session. we_manager and the engine with its wallpaper must be running again afterwards. the engine has to be installed
+# (wem_check.sh does it); LOGIN_PASSWORD types a password at a greeter without autologin; we_manager is started with --remote-debugging-port=9222 unless it already runs that way.
+HERE=$(cd "$(dirname "$0")" && pwd)
+vm=$1 screen=${3:-Virtual-1}
+sshv() { "$HERE/linuxvm.sh" ssh "$vm" "$@" </dev/null; }
+status=0
+pass() { echo "PASS $1"; }
+fail() { echo "FAIL $1"; status=1; }
+cdp() { sshv ". ~/sessenv; cd ~/wem; timeout ${CDP_TIMEOUT:-90} python3 cdp.py \"$1\" 2>&1 | cut -c1-500"; }
+
+if ! cdp 'window.electronAPI.lwe.listScreens()' | grep -q "$screen"; then
+    sshv 'pkill -f "[w]e-manager"; true'; sleep 3
+    if [[ $2 == installed ]]; then start="we-manager ${WEM_FLAGS:-}"; else start="~/wem/$(basename "$2")/we-manager --no-sandbox ${WEM_FLAGS:-}"; fi
+    sshv ". ~/sessenv; (setsid nohup $start --remote-debugging-port=9222 > ~/wem/app-auto.log 2>&1 </dev/null &); sleep 25"
+fi
+sshv 'cd ~/.steam/steam/steamapps/workshop/content/431960 && for id in 1120596121 1078208425; do [ -L $id ] && rm $id; [ -d $id ] || cp -al ~/lwe/wp-$id $id; done'  # the scan skips symlinked folders
+cdp 'window.electronAPI.library.scan()' >/dev/null
+# an autostarted we_manager only brings wallpapers back through its autostart playlist (or a playlist that was playing)
+out=$(cdp "(async () => { const p = await window.electronAPI.playlist.create('autostart-test'); await window.electronAPI.playlist.addItems(p.id, ['1120596121']); await window.electronAPI.config.setAutostart(true, true, p.id); return p.id })()")
+if echo "$out" | grep -q 'Traceback\|rror'; then fail "playlist for the autostart: $out"; else pass "autostart playlist made: $out"; fi
+entry=$(sshv 'grep "^Exec=" ~/.config/autostart/we-manager.desktop 2>/dev/null')
+[ -n "$entry" ] && pass "autostart entry: $entry" || { fail "no autostart entry"; exit 1; }
+[ -n "$WEM_FLAGS" ] && sshv "sed -i \"s|^\\(Exec=.*\\)\$|\\1 $WEM_FLAGS|\" ~/.config/autostart/we-manager.desktop"  # COSMIC in the VM needs --disable-gpu-compositing
+sleep 5
+sshv 'sync; sudo systemctl reboot' >/dev/null 2>&1
+sleep 20
+up=0
+logged_in=0
+for _ in $(seq 90); do
+    # a greeter without autologin (COSMIC): type the password once the VM answers
+    if [ -n "$LOGIN_PASSWORD" ] && [ $logged_in = 0 ] && sshv 'true' 2>/dev/null; then
+        sleep 25; "$HERE/linuxvm.sh" type "$vm" "$LOGIN_PASSWORD"; "$HERE/linuxvm.sh" keys "$vm" ret; logged_in=1
+    fi
+    sshv 'true' 2>/dev/null && sshv 'bash ~/lwe/sessenv.sh' >/dev/null 2>&1 && { up=1; break; }
+    sleep 4
+done
+[ $up = 1 ] && pass "the VM is back with its desktop session" || { fail "no desktop session after the reboot"; exit 1; }
+for _ in $(seq 40); do
+    [ "$(sshv 'pgrep -fc "[w]e-manager"')" -gt 0 ] && break
+    sleep 3
+done
+[ "$(sshv 'pgrep -fc "[w]e-manager"')" -gt 0 ] && pass "we_manager started by the session" || fail "we_manager did not come back: $(sshv 'ls ~/.config/autostart')"
+for _ in $(seq 40); do
+    [ "$(sshv 'pgrep -fc "/[l]inux-wallpaperengine(\.bin)? "')" -gt 0 ] && break
+    sleep 3
+done
+engines=$(sshv 'pgrep -fa "/[l]inux-wallpaperengine(\.bin)? " | head -1 | cut -c1-200')
+[ -n "$engines" ] && pass "the engine came back: $engines" || fail "no engine after the reboot"
+sleep 15
+tmp=$(mktemp -d)
+"$HERE/linuxvm.sh" shot "$vm" "$tmp/after.png" && echo "     screenshot of the desktop after the reboot: $tmp/after.png"
+exit $status

+ 48 - 0
tools/linuxvm/bump_deb.py

@@ -0,0 +1,48 @@
+#!/usr/bin/env python3
+"""bump_deb.py <in.deb> <out.deb> <version> - the same package with another Version in its control file, so a .deb can
+stand in for a newer release (fake_github.py). Needs no dpkg: a .deb is an ar archive and control.tar.* holds the file."""
+import io
+import re
+import sys
+import tarfile
+
+
+def read_ar(data):
+    assert data[:8] == b"!<arch>\n"
+    pos, members = 8, []
+    while pos < len(data):
+        header = data[pos:pos + 60]
+        name = header[:16].decode().strip().rstrip("/")
+        size = int(header[48:58])
+        members.append((name, data[pos + 60:pos + 60 + size], header))
+        pos += 60 + size + (size & 1)
+    return members
+
+
+def bump_control(blob, name, version):
+    mode = {"gz": "gz", "xz": "xz", "zst": None}.get(name.rsplit(".", 1)[-1])
+    if mode is None:
+        sys.exit(f"{name}: compression not supported, repack the .deb with xz or gzip")
+    out = io.BytesIO()
+    with tarfile.open(fileobj=io.BytesIO(blob), mode="r:" + mode) as src, tarfile.open(fileobj=out, mode="w:" + mode) as dst:
+        for member in src:
+            data = src.extractfile(member).read() if member.isfile() else None
+            if member.name.endswith("control") and data is not None:
+                data = re.sub(rb"(?m)^Version: .*$", b"Version: " + version.encode(), data)
+                member.size = len(data)
+            dst.addfile(member, io.BytesIO(data) if data is not None else None)
+    return out.getvalue()
+
+
+def main():
+    source, target, version = sys.argv[1:4]
+    members = read_ar(open(source, "rb").read())
+    out = bytearray(b"!<arch>\n")
+    for name, blob, header in members:
+        if name.startswith("control.tar"):
+            blob = bump_control(blob, name, version)
+        out += header[:48] + str(len(blob)).ljust(10).encode() + header[58:60] + blob + (b"\n" if len(blob) & 1 else b"")
+    open(target, "wb").write(out)
+
+
+main()

+ 45 - 0
tools/linuxvm/deps_check.sh

@@ -0,0 +1,45 @@
+#!/bin/bash
+# deps_check.sh <vm> <app dir | installed> [source tarball] - we_manager's "install build dependencies" for a source build
+# on the VM's package manager (pkexec with a polkit rule for the lab user standing in for the dialog), then the engine's
+# CMake configure on the source tarball: it only passes when everything the build needs got installed. SKIPs the
+# install on image based systems (we_manager refuses there). Needs the session running (sessenv).
+HERE=$(cd "$(dirname "$0")" && pwd)
+vm=$1 app=$2 src=${3:-/tmp/claude-1000/lwe-src.tgz}
+sshv() { "$HERE/linuxvm.sh" ssh "$vm" "$@" </dev/null; }
+status=0
+pass() { echo "PASS $1"; }
+fail() { echo "FAIL $1"; status=1; }
+cdp() { sshv ". ~/sessenv; cd ~/wem; timeout ${2:-900} timeout ${CDP_TIMEOUT:-90} python3 cdp.py \"$1\" 2>&1 | cut -c1-600"; }
+
+sshv 'mkdir -p ~/wem; pkill -f "[w]e-manager" 2>/dev/null
+sudo mkdir -p /etc/polkit-1/rules.d
+printf "polkit.addRule(function(action, subject) { if (subject.user == \"lab\") return polkit.Result.YES; });\n" | sudo tee /etc/polkit-1/rules.d/49-lab-test.rules >/dev/null; true'
+"$HERE/linuxvm.sh" scp "$vm" "$HERE/cdp.py" wem/cdp.py
+if [ -d "$app" ]; then
+    rm_old=$(basename "$app"); sshv "rm -rf ~/wem/$rm_old"
+    tar -C "$(dirname "$app")" -cf - "$rm_old" | ssh -i "$HOME/.local/share/linuxvm/id_ed25519" -p "$(cat "$HOME/.local/share/linuxvm/vms/$vm/port")" \
+        -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR lab@127.0.0.1 'mkdir -p ~/wem && tar -C ~/wem -xf -'
+fi
+if [[ $app == installed ]]; then start="we-manager ${WEM_FLAGS:-}"; else start="~/wem/$(basename "$app")/we-manager --no-sandbox ${WEM_FLAGS:-}"; fi
+sshv ". ~/sessenv; (setsid nohup $start --remote-debugging-port=9222 > ~/wem/app-deps.log 2>&1 </dev/null &); sleep 25"
+distro=$(cdp 'window.electronAPI.lwe.detectDistro()'); echo "     detected distro: $distro"
+if sshv 'test -e /run/ostree-booted'; then
+    echo "SKIP dependency install: image based system, we_manager refuses it (no source build there, nothing to configure)"
+    sshv 'pkill -f "[w]e-manager" 2>/dev/null; sudo rm -f /etc/polkit-1/rules.d/49-lab-test.rules; true'
+    exit 0
+else
+    out=$(cdp 'window.electronAPI.lwe.installDeps()' 1200)
+    if echo "$out" | grep -q '"ok": true'; then pass "we_manager installed the build dependencies ($distro)"; else fail "dependency install: $out"; fi
+fi
+if [ -n "$LIBNODE_PKG" ]; then
+    # Arch only has libnode in the AUR, we_manager leaves it to the user: a package built from the AUR recipe stands in
+    "$HERE/linuxvm.sh" scp "$vm" "$LIBNODE_PKG" libnode.pkg.tar.zst
+    sshv 'sudo pacman -U --noconfirm ~/libnode.pkg.tar.zst >/tmp/libnode.log 2>&1; tail -1 /tmp/libnode.log'
+fi
+"$HERE/linuxvm.sh" scp "$vm" "$src" lwe-src.tgz
+out=$(sshv 'rm -rf ~/src && mkdir ~/src && tar -C ~/src -xzf ~/lwe-src.tgz && cd ~/src && cmake -S . -B build -DCMAKE_BUILD_TYPE=Release > /tmp/cmake-deps.log 2>&1; echo rc=$?; grep -E "Found V8|CMake Error|Could NOT|not found" /tmp/cmake-deps.log | head -5')
+if echo "$out" | grep -q 'Could NOT find V8' && ! sshv 'ls /usr/lib64/libnode.so* /usr/lib/libnode.so* /usr/lib/*/libnode.so* >/dev/null 2>&1'; then
+    echo "SKIP engine configure: this release has no Node.js shared library (libnode), a source build is not possible, the prebuilt engine is the way (we_manager says so after the install)"
+elif echo "$out" | grep -q '^rc=0'; then pass "the engine configures with those packages: $(echo "$out" | grep "Found V8")"; else fail "cmake configure failed: $out"; fi
+sshv 'pkill -f "[w]e-manager" 2>/dev/null; sudo rm -f /etc/polkit-1/rules.d/49-lab-test.rules; true'
+exit $status

+ 4 - 2
tools/linuxvm/fake_github.py

@@ -3,7 +3,7 @@
 
     fake_github.py <dir> [--release REPO=TAG:FILE[,FILE...]]... [--port 443]
 
-<dir> gets a CA and a certificate for api.github.com on the first run (ca.pem, cert.pem, key.pem; needs openssl).
+<dir> gets a CA and a certificate for api.github.com on the first run (ca.pem, cert.pem, key.pem; needs openssl, OPENSSL names another binary, openssl_proot.sh is used when there is none).
 The VM resolves api.github.com to this server (/etc/hosts) and trusts ca.pem, e.g. NODE_EXTRA_CA_CERTS for
 Electron's main process. GET /repos/<REPO>/releases/latest answers with the release given for it (assets with size
 and a sha256 digest like GitHub's, downloaded from this server), every other repo with 404. Requests are logged to
@@ -13,6 +13,8 @@ import argparse
 import hashlib
 import http.server
 import json
+import os
+import shutil
 import ssl
 import subprocess
 import sys
@@ -27,7 +29,7 @@ def make_certificate(folder):
     folder.mkdir(parents=True, exist_ok=True)
 
     def openssl(*args):
-        subprocess.run(["openssl", *args], check=True, cwd=folder, capture_output=True)
+        subprocess.run([os.environ.get("OPENSSL") or shutil.which("openssl") or str(Path(__file__).with_name("openssl_proot.sh")), *args], check=True, cwd=folder, capture_output=True)
 
     openssl("req", "-x509", "-newkey", "rsa:2048", "-nodes", "-days", "30", "-subj", "/CN=fake github test CA",
             "-keyout", "ca-key.pem", "-out", "ca.pem")

+ 54 - 0
tools/linuxvm/flatpak_check.sh

@@ -0,0 +1,54 @@
+#!/bin/bash
+# flatpak_check.sh <vm> <bundle.flatpak | installed> [screen] - the Flatpak build of we_manager in a VM's desktop session:
+# installs the bundle (unless "installed"), starts it with DevTools (cdp.py reaches it, the sandbox shares the network),
+# scans the library, launches a scene and a web wallpaper through it, checks stop and kill all leave nothing behind and
+# the autostart entry starts the Flatpak. Needs flatpak and the 25.08 runtime + Electron BaseApp on the VM, and the
+# session running (sessenv). One PASS|FAIL line per check.
+HERE=$(cd "$(dirname "$0")" && pwd)
+vm=$1 bundle=$2 screen=${3:-Virtual-1}
+app=io.github.WallpaperEngineLover.we_manager
+sshv() { "$HERE/linuxvm.sh" ssh "$vm" "$@" </dev/null; }
+status=0
+pass() { echo "PASS $1"; }
+fail() { echo "FAIL $1"; status=1; }
+cdp() { sshv ". ~/sessenv; cd ~/wem; timeout ${CDP_TIMEOUT:-90} python3 cdp.py \"$1\" 2>&1 | cut -c1-500"; }
+# gone: waits up to 20 s for the engines and web helpers to end, a stop in a Flatpak goes through flatpak-spawn
+gone() { for _ in $(seq 20); do [ "$(left)" = "0 0" ] && return 0; sleep 1; done; return 1; }
+left() { sshv 'echo $(pgrep -fc "/[l]inux-wallpaperengine(\.bin)? ") $(pgrep -fc "[w]eb-helper")'; }
+
+sshv 'mkdir -p ~/wem'
+"$HERE/linuxvm.sh" scp "$vm" "$HERE/cdp.py" wem/cdp.py
+if [ "$bundle" != installed ]; then
+    "$HERE/linuxvm.sh" scp "$vm" "$bundle" wem/app.flatpak
+    sshv "flatpak --user remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo; flatpak --user install -y --noninteractive --reinstall ~/wem/app.flatpak >/tmp/fp-install.log 2>&1" && pass "the bundle installs" || fail "bundle install: $(sshv 'tail -3 /tmp/fp-install.log')"
+fi
+sshv 'pkill -f "[w]e-manager" 2>/dev/null; true'
+sshv 'mkdir -p ~/.steam/steam/steamapps/common/wallpaper_engine ~/.steam/steam/steamapps/workshop/content/431960
+ln -sfn ~/lwe/assets ~/.steam/steam/steamapps/common/wallpaper_engine/assets
+cd ~/.steam/steam/steamapps/workshop/content/431960; for id in 1120596121 1078208425; do [ -L $id ] && rm $id; [ -d $id ] || cp -al ~/lwe/wp-$id $id; done'
+sshv ". ~/sessenv; (setsid nohup flatpak run $app --remote-debugging-port=9222 > ~/wem/fp-app.log 2>&1 </dev/null &); sleep 30"
+[ "$(sshv 'pgrep -fc "[w]e-manager"')" -gt 0 ] && pass "the Flatpak starts" || { fail "the Flatpak did not start: $(sshv 'tail -3 ~/wem/fp-app.log')"; exit 1; }
+
+out=$(cdp 'window.electronAPI.lwe.prebuiltTarget()'); echo "     prebuilt target: $out" | cut -c1-200
+out=$(cdp 'window.electronAPI.lwe.status ? window.electronAPI.lwe.status() : window.electronAPI.lwe.getStatus()')
+echo "$out" | grep -q '"installed": true' && pass "the bundled engine is found: $(echo "$out" | grep -o '"path": "[^"]*"')" || fail "no engine inside the Flatpak: $out"
+out=$(cdp 'window.electronAPI.lwe.listScreens()')
+echo "$out" | grep -q "$screen" && pass "screens found through the host: $out" || fail "screen $screen not found: $out"
+cdp 'window.electronAPI.library.scan()' > /dev/null
+home=$(sshv 'echo $HOME')/.steam/steam/steamapps/workshop/content/431960
+for id in 1120596121 1078208425; do
+    out=$(cdp "window.electronAPI.lwe.launch('$home/$id', {screen: '$screen'})"); sleep 35
+    engines=$(sshv 'pgrep -fc "/[l]inux-wallpaperengine(\.bin)? "')
+    if echo "$out" | grep -q '"running": true' && [ "$engines" -gt 0 ]; then pass "$id launched from the Flatpak ($engines engine processes)"; else fail "$id did not launch: $out"; fi
+    cdp 'window.electronAPI.lwe.stop()' >/dev/null
+    gone && pass "$id: stop leaves nothing behind" || fail "$id: after stop engines/helpers: $(left)"
+done
+cdp "window.electronAPI.lwe.launch('$home/1078208425', {screen: '$screen'})" >/dev/null; sleep 30
+cdp 'window.electronAPI.lwe.killAll()' >/dev/null
+gone && pass "kill all leaves nothing behind" || fail "after kill all engines/helpers: $(left)"
+
+cdp 'window.electronAPI.config.setAutostart(true, true, null)' >/dev/null
+entry=$(sshv 'grep "^Exec=" ~/.config/autostart/*.desktop 2>/dev/null')
+echo "$entry" | grep -q "flatpak run" && pass "autostart starts the Flatpak: $entry" || fail "autostart entry does not start the Flatpak: $entry"
+sshv 'pkill -f "[w]e-manager" 2>/dev/null; true'
+exit $status

+ 5 - 3
tools/linuxvm/fullscreen_window.py

@@ -1,15 +1,17 @@
-"""fullscreen_window.py - a plain fullscreen window for the pause-on-fullscreen check (GTK 3, else GTK 4).
+"""fullscreen_window.py [maximize] - a plain fullscreen (or maximized) window for the pause checks (GTK 3, else GTK 4).
 Runs until it is killed. Exit code 2 when neither GTK is importable."""
 import sys
 
 import gi
 
+MAXIMIZE = sys.argv[1:2] == ["maximize"]
+
 try:
     gi.require_version("Gtk", "3.0")
     from gi.repository import Gtk
 
     window = Gtk.Window(title="lwe-fullscreen-test")
-    window.fullscreen()
+    window.maximize() if MAXIMIZE else window.fullscreen()
     window.connect("destroy", Gtk.main_quit)
     window.show_all()
     Gtk.main()
@@ -22,7 +24,7 @@ except (ValueError, ImportError):
 
     def activate(app):
         window = Gtk.ApplicationWindow(application=app, title="lwe-fullscreen-test")
-        window.fullscreen()
+        window.maximize() if MAXIMIZE else window.fullscreen()
         window.present()
 
     app = Gtk.Application(application_id="test.lwe.Fullscreen")

+ 59 - 19
tools/linuxvm/guest_test.sh

@@ -26,7 +26,7 @@ engine_pids() { pgrep -f "^$LWE_DIR/lwe-hints/linux-wallpaperengine.[b]in"; }
 take_shot() {
     if [ "$SHOT_CMD" = host ]; then
         touch "$1.want"
-        for _ in $(seq 60); do [ -s "$1" ] && break; sleep 1; done
+        for _ in $(seq 120); do [ -s "$1" ] && break; sleep 1; done
     else
         eval "$SHOT_CMD" > "$2" 2>&1
     fi
@@ -66,6 +66,13 @@ for id in $WALLPAPERS; do
     if stop_engine; then pass "$id: engine stopped on SIGTERM"; else fail "$id: engine needed SIGKILL"; fi
     if pgrep -f "[l]inux-wallpaperengine-web-helper" >/dev/null; then fail "$id: web helper left behind"; else pass "$id: no web helper left behind"; fi
 done
+# the test window's own command line is the pattern: toolkits start helpers and detach, the shell's pid is not enough
+stop_fullscreen_window() {
+    [ -n "$STOP_CMD" ] && pkill -f -- "^${STOP_CMD%% *}.*${STOP_CMD#* }" 2>/dev/null
+    pkill -f "lwe-fullscreen-test|fullscreen_window.py|maximize_kde.sh|konsole -e sleep" 2>/dev/null
+    return 0
+}
+
 # wait_for_log <file> <text> <seconds> <lines of it seen before>: true once more lines than that contain the text
 wait_for_log() {
     for _ in $(seq "$3"); do
@@ -75,6 +82,55 @@ wait_for_log() {
     return 1
 }
 
+# pause_check <label> <command>: a window opened by the command must pause the engine (a "Paused: windows" log line) and
+# closing it must resume it. An empty command is skipped.
+pause_check() {
+    local label=$1 cmd=$2 log=$OUT/engine-behavior.log
+    if [ -z "$cmd" ]; then echo "SKIP $label pause: no command for this desktop"; return; fi
+    STOP_CMD=$cmd
+    stop_fullscreen_window
+    local paused_before resumed_before fs_pid
+    paused_before=$(grep -c "Paused: windows" "$log"); resumed_before=$(grep -c "Resumed" "$log")
+    eval "$cmd" > "$OUT/$label-window.log" 2>&1 &
+    fs_pid=$!
+    sleep 2
+    if [ "$SHOT_CMD" = host ]; then
+        touch "$OUT/focus.click"
+        for _ in $(seq 10); do [ -e "$OUT/focus.click" ] || break; sleep 1; done
+    fi
+    if ! kill -0 "$fs_pid" 2>/dev/null; then
+        fail "$label pause: the test window did not start ($(head -c 150 "$OUT/$label-window.log" | tr '\n' ' '))"
+    elif grep -q "Fullscreen detection not supported" "$log"; then
+        echo "SKIP $label pause: the compositor has no window state detection"
+    elif wait_for_log "$log" "Paused: windows" 45 "$paused_before"; then
+        pass "$label pause: engine paused"
+        kill "$fs_pid" 2>/dev/null; stop_fullscreen_window
+        if wait_for_log "$log" "Resumed" 45 "$resumed_before"; then pass "$label pause: engine resumed"; else fail "$label pause: no resume after the window closed"; fi
+    else
+        fail "$label pause: no pause within 45s of a $label window"
+        {
+            echo "--- state at the failed $label check, $(date +%T)"
+            echo "window processes:"; pgrep -fa "konsole|fullscreen_window|maximize_kde" | cut -c1-120
+            echo "engine bus names:"; busctl --user list 2>/dev/null | grep -i linuxwallpaper
+            echo "kwin scripts left in the runtime dir:"; ls "$XDG_RUNTIME_DIR" 2>/dev/null | grep -E "^lwe-"
+            echo "engine log tail:"; grep -v '^ALSA' "$log" | tail -5 | cut -c1-160
+            if command -v gdbus >/dev/null && gdbus introspect --session --dest org.kde.KWin --object-path /Scripting >/dev/null 2>&1; then
+                echo "KWin's window list:"
+                diag=$(mktemp /tmp/lwe-diag-XXXXXX.js)
+                echo 'for (const w of workspace.windowList()) print("LWEDIAG", w.resourceClass, w.caption, "fs=" + w.fullScreen, "max=" + (w.maximizeMode), "min=" + w.minimized, "out=" + (w.output ? w.output.name : "none"), "desktops=" + w.desktops.length, "normal=" + w.normalWindow);' > "$diag"
+                id=$(gdbus call --session --dest org.kde.KWin --object-path /Scripting --method org.kde.kwin.Scripting.loadScript "$diag" lwe-diag | tr -dc 0-9)
+                gdbus call --session --dest org.kde.KWin --object-path "/Scripting/Script$id" --method org.kde.kwin.Script.run >/dev/null 2>&1
+                sleep 1
+                journalctl --user -b --no-pager 2>/dev/null | grep LWEDIAG | tail -12 | cut -c1-220
+                gdbus call --session --dest org.kde.KWin --object-path /Scripting --method org.kde.kwin.Scripting.unloadScript lwe-diag >/dev/null 2>&1
+                rm -f "$diag"
+            fi
+        } >> "$OUT/pause-diagnostics.txt" 2>&1
+    fi
+    kill "$fs_pid" 2>/dev/null; stop_fullscreen_window
+    sleep 3
+}
+
 # behaviour checks, BEHAVIOR=1: hotswap, pause on fullscreen, SIGKILL leaves no helper
 if [ "${BEHAVIOR:-0}" = 1 ]; then
     A=${HOTSWAP_FROM:-1120596121}
@@ -96,24 +152,8 @@ if [ "${BEHAVIOR:-0}" = 1 ]; then
 
         # back to the first wallpaper so the CPU numbers are of a scene with particles
         echo "path=$LWE_DIR/wp-$A" > "$ctl"; kill -USR1 "$pid"; sleep 12
-        if [ -n "$FULLSCREEN_CMD" ]; then
-            log=$OUT/engine-behavior.log
-            paused_before=$(grep -c "Paused: windows" "$log"); resumed_before=$(grep -c "Resumed" "$log")
-            eval "$FULLSCREEN_CMD" > "$OUT/fullscreen-window.log" 2>&1 &
-            fs_pid=$!
-            if grep -q "Fullscreen detection not supported" "$log"; then
-                echo "SKIP fullscreen pause: the compositor has no fullscreen detection"
-            elif wait_for_log "$log" "Paused: windows" 45 "$paused_before"; then
-                pass "fullscreen pause: engine paused"
-                kill "$fs_pid" 2>/dev/null; pkill -f "lwe-fullscreen-test|fullscreen_window.py" 2>/dev/null
-                if wait_for_log "$log" "Resumed" 45 "$resumed_before"; then pass "fullscreen pause: engine resumed"; else fail "fullscreen pause: no resume after the window closed"; fi
-            else
-                fail "fullscreen pause: no pause within 45s of a fullscreen window"
-            fi
-            kill "$fs_pid" 2>/dev/null; pkill -f "lwe-fullscreen-test|fullscreen_window.py" 2>/dev/null
-        else
-            echo "SKIP fullscreen pause: no FULLSCREEN_CMD for this desktop"
-        fi
+        pause_check "fullscreen" "$FULLSCREEN_CMD"
+        pause_check "maximized" "$MAXIMIZE_CMD"
         stop_engine
     fi
 

+ 7 - 2
tools/linuxvm/host_shots.sh

@@ -1,15 +1,20 @@
 #!/bin/bash
 # host_shots.sh <vm> <guest out dir> [seconds] - serves the "SHOT_CMD=host" requests of guest_test.sh: whenever the guest
 # creates <file>.png.want, takes a screenshot of the VM's display (the same VNC socket `linuxvm.sh shot` uses) and copies
-# it into the guest as <file>.png. Runs until the seconds (default 900) are over or the guest's test run has finished
+# it into the guest as <file>.png, and clicks the screen's centre for every <file>.click (focus for a test window). Runs until the seconds (default 900) are over or the guest's test run has finished
 # (the guest creates <out dir>/done).
 HERE=$(cd "$(dirname "$0")" && pwd)
 vm=$1 out=$2 limit=${3:-900}
 tmp=$(mktemp -d)
 end=$((SECONDS + limit))
 while [ $SECONDS -lt $end ]; do
-    wanted=$("$HERE/linuxvm.sh" ssh "$vm" "ls $out/*.want 2>/dev/null; [ -e $out/done ] && echo DONE" </dev/null 2>/dev/null)
+    wanted=$("$HERE/linuxvm.sh" ssh "$vm" "find $out -maxdepth 1 \\( -name '*.want' -o -name '*.click' \\) 2>/dev/null; [ -e $out/done ] && echo DONE" </dev/null 2>/dev/null)
     echo "$wanted" | grep -q '^DONE$' && break
+    # a window the test opened needs the focus (GNOME holds back new windows of background processes): click it
+    for click in $(echo "$wanted" | grep '\.click$'); do
+        "$HERE/linuxvm.sh" pointer "$vm" 960 540 >/dev/null && "$HERE/linuxvm.sh" click "$vm" >/dev/null
+        "$HERE/linuxvm.sh" ssh "$vm" "rm -f $click" </dev/null
+    done
     for want in $(echo "$wanted" | grep '\.want$'); do
         name=$(basename "${want%.want}")
         "$HERE/linuxvm.sh" shot "$vm" "$tmp/$name" && "$HERE/linuxvm.sh" scp "$vm" "$tmp/$name" "${want%.want}" \

+ 21 - 2
tools/linuxvm/linuxvm.sh

@@ -4,10 +4,10 @@
 # (uid 1000, password "lab", passwordless sudo), reached over ssh on a localhost port. The guest GPU is virtio-vga-gl
 # with QEMU's egl-headless display on the container's render node (virgl), so nothing ever shows on the desktop's
 # display; screenshots and pointer input go through QMP. No audio device unless started with `desktop`.
-#   fetch                 downloads the cloud images (Fedora 44, Arch, Ubuntu 24.04, Debian 13, openSUSE Tumbleweed)
+#   fetch                 downloads the cloud images (Fedora 44, Arch, Ubuntu 24.04, Debian 13, openSUSE Tumbleweed and Leap 16)
 #                         and the installer ISOs (Linux Mint Cinnamon, Manjaro KDE, Pop!_OS, Bazzite)
 #   create <vm> <image>   new VM from images/<image>.qcow2 (fedora-44, arch, ubuntu-24.04, debian-13,
-#                         opensuse-tumbleweed), 60G overlay
+#                         opensuse-tumbleweed, opensuse-leap-16), 60G overlay
 #   create-iso <vm> <iso> blank 60G disk that boots images/<iso>.iso (a distro installer, e.g. linuxmint-22.3-cinnamon);
 #                         remove <vm>/boot.iso after installing. Such a VM has no cloud-init, ssh needs setting up by hand
 #   start <vm>            boots it (LINUXVM_CPUS, LINUXVM_MEM, LINUXVM_SIZE=WxH for the display)
@@ -17,6 +17,8 @@
 #   ssh <vm> [cmd]        runs a command as lab (or a shell)
 #   scp <vm> <src> <dst>  copies into the VM (dst relative to /home/lab)
 #   shot <vm> <png>       screenshot through the VNC socket (vncshot.py); pointer/click/keys/type/raw go to qmp.py
+#   golden <vm>           freezes a stopped VM's disk as golden.qcow2 (and its UEFI vars) and puts a throwaway overlay on top
+#   fresh <vm>            throws the overlay away: the next start begins from the golden state again (release_check.sh)
 #   stop | kill <vm>      ACPI power off | kill QEMU
 # QEMU's virtio-gpu and egl-headless modules are not in the image's qemu-system-x86-core: `fetch` unpacks the Fedora
 # RPMs (plus virglrenderer) into $LINUXVM/root and QEMU_MODULE_DIR points there.
@@ -49,6 +51,8 @@ fetch)
         https://cloud.debian.org/images/cloud/trixie/latest/debian-13-genericcloud-amd64.qcow2
     [ -f opensuse-tumbleweed.qcow2 ] || curl -fLo opensuse-tumbleweed.qcow2 \
         https://download.opensuse.org/tumbleweed/appliances/openSUSE-Tumbleweed-Minimal-VM.x86_64-Cloud.qcow2
+    [ -f opensuse-leap-16.qcow2 ] || curl -fLo opensuse-leap-16.qcow2 \
+        https://download.opensuse.org/distribution/leap/16.0/appliances/Leap-16.0-Minimal-VM.x86_64-Cloud.qcow2
     [ -f linuxmint-22.3-cinnamon.iso ] || curl -fLo linuxmint-22.3-cinnamon.iso \
         https://mirrors.kernel.org/linuxmint/stable/22.3/linuxmint-22.3-cinnamon-64bit.iso
     [ -f manjaro-kde.iso ] || curl -fLo manjaro-kde.iso \
@@ -157,6 +161,21 @@ scp)
     scp -i "$KEY" -P "$(port "$2")" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR \
         -r "$3" "lab@127.0.0.1:$4"
     ;;
+golden)
+    dir=$(vmdir "$2")
+    [ -f "$dir/qemu.pid" ] && kill -0 "$(cat "$dir/qemu.pid")" 2>/dev/null && { echo "$2 is running, stop it first"; exit 1; }
+    [ -f "$dir/golden.qcow2" ] && { echo "$2 has a golden disk already (delete $dir/golden.qcow2 to redo)"; exit 1; }
+    mv "$dir/disk.qcow2" "$dir/golden.qcow2" && cp "$dir/vars.fd" "$dir/golden-vars.fd" \
+        && qemu-img create -q -f qcow2 -F qcow2 -b "$dir/golden.qcow2" "$dir/disk.qcow2" \
+        && echo "$2: golden disk saved, the VM now runs on an overlay"
+    ;;
+fresh)
+    dir=$(vmdir "$2")
+    [ -f "$dir/golden.qcow2" ] || { echo "$2 has no golden disk"; exit 1; }
+    [ -f "$dir/qemu.pid" ] && kill -0 "$(cat "$dir/qemu.pid")" 2>/dev/null && { echo "$2 is running, stop it first"; exit 1; }
+    rm -f "$dir/disk.qcow2" && qemu-img create -q -f qcow2 -F qcow2 -b "$dir/golden.qcow2" "$dir/disk.qcow2" \
+        && cp "$dir/golden-vars.fd" "$dir/vars.fd" && echo "$2: back to the golden state"
+    ;;
 stop)
     $QMP "$(vmdir "$2")/qmp.sock" raw '{"execute":"system_powerdown"}'
     ;;

+ 15 - 0
tools/linuxvm/maximize_kde.sh

@@ -0,0 +1,15 @@
+#!/bin/bash
+# maximize_kde.sh - a Konsole window maximized by a KWin script, for the pause-on-maximized check on Plasma (Konsole has
+# no maximize option, KWin 6 scripts have workspace.activeWindow.setMaximize). Runs until it is killed.
+konsole -e sleep 100000 &
+terminal=$!
+trap 'kill $terminal 2>/dev/null' EXIT
+sleep 4
+script=$(mktemp /tmp/lwe-maximize-XXXXXX.js)
+echo 'workspace.activeWindow.setMaximize(true, true);' > "$script"
+id=$(gdbus call --session --dest org.kde.KWin --object-path /Scripting --method org.kde.kwin.Scripting.loadScript "$script" lwe-maximize-test | tr -dc '0-9')
+gdbus call --session --dest org.kde.KWin --object-path "/Scripting/Script$id" --method org.kde.kwin.Script.run >/dev/null
+sleep 2
+gdbus call --session --dest org.kde.KWin --object-path /Scripting --method org.kde.kwin.Scripting.unloadScript lwe-maximize-test >/dev/null
+rm -f "$script"
+wait $terminal

+ 9 - 0
tools/linuxvm/openssl_proot.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+# openssl_proot.sh <args> - openssl from the Debian 12 rootfs (tools/distro_rootfs.sh) for hosts without one, in the
+# current directory: OPENSSL=$PWD/openssl_proot.sh fake_github.py ...
+ROOTFS=${ROOTFS:-$HOME/.local/share/distro-rootfs/debian-12}
+here=$(cd "$(dirname "$0")/.." && pwd)
+cwd=$PWD
+quoted=$(printf '%q ' "$@")
+PROOT=${PROOT:-$HOME/.local/share/arch-proot/proot} BINDS="-b $cwd:$cwd" \
+    "$here/distro_rootfs.sh" run "$ROOTFS" sh -c "cd $cwd && openssl $quoted"

+ 6 - 0
tools/linuxvm/profiles/arch-xfce.sh

@@ -0,0 +1,6 @@
+VM=arch-xfce
+SCREEN=Virtual-1
+SHOT_CMD=host
+FULLSCREEN_CMD='bash -c "xterm -T lwe-fullscreen-test -e sleep 100000 & sleep 2; wmctrl -r lwe-fullscreen-test -b add,fullscreen; wait"'
+WEM=app
+PREP='xset s off -dpms; pkill -f "[x]fce4-screensaver"; pkill -f "[x]fce4-power-manager"; true'

+ 8 - 0
tools/linuxvm/profiles/bazzite.sh

@@ -0,0 +1,8 @@
+VM=bazzite
+SCREEN=Virtual-1
+SHOT_CMD=host
+FULLSCREEN_CMD='python3 ~/lwe/fullscreen_window.py'
+MAXIMIZE_CMD='python3 ~/lwe/fullscreen_window.py maximize'
+WEM=app
+PREP='(setsid nohup kde-inhibit --power --screenSaver sleep 100000 >/dev/null 2>&1 &)'
+LOGIN_PASSWORD=lab

+ 6 - 0
tools/linuxvm/profiles/debian-gnome.sh

@@ -0,0 +1,6 @@
+VM=debian-gnome
+SCREEN=Virtual-1
+SHOT_CMD=host
+FULLSCREEN_CMD='python3 ~/lwe/fullscreen_window.py'
+MAXIMIZE_CMD='python3 ~/lwe/fullscreen_window.py maximize'
+WEM=deb

+ 6 - 0
tools/linuxvm/profiles/debian-xfce.sh

@@ -0,0 +1,6 @@
+VM=debian-xfce
+SCREEN=Virtual-1
+SHOT_CMD=host
+FULLSCREEN_CMD='bash -c "xterm -T lwe-fullscreen-test -e sleep 100000 & sleep 2; wmctrl -r lwe-fullscreen-test -b add,fullscreen; wait"'
+WEM=deb
+PREP='xset s off -dpms; pkill -f "[x]fce4-screensaver"; pkill -f "[x]fce4-power-manager"; true'

+ 6 - 0
tools/linuxvm/profiles/fedora-gnome.sh

@@ -0,0 +1,6 @@
+VM=fedora-gnome
+SCREEN=Virtual-1
+SHOT_CMD=host
+FULLSCREEN_CMD='python3 ~/lwe/fullscreen_window.py'
+MAXIMIZE_CMD='python3 ~/lwe/fullscreen_window.py maximize'
+WEM=app

+ 7 - 0
tools/linuxvm/profiles/fedora-kde.sh

@@ -0,0 +1,7 @@
+VM=fedora-kde
+SCREEN=Virtual-1
+SHOT_CMD=host
+FULLSCREEN_CMD='konsole --fullscreen'
+MAXIMIZE_CMD='~/lwe/maximize_kde.sh'
+WEM=app
+PREP='(setsid nohup kde-inhibit --power --screenSaver sleep 100000 >/dev/null 2>&1 &)'

+ 7 - 0
tools/linuxvm/profiles/manjaro-kde.sh

@@ -0,0 +1,7 @@
+VM=manjaro-kde
+SCREEN=Virtual-1
+SHOT_CMD=host
+FULLSCREEN_CMD='konsole --fullscreen'
+MAXIMIZE_CMD='~/lwe/maximize_kde.sh'
+WEM=app
+PREP='(setsid nohup kde-inhibit --power --screenSaver sleep 100000 >/dev/null 2>&1 &)'

+ 7 - 0
tools/linuxvm/profiles/opensuse-kde.sh

@@ -0,0 +1,7 @@
+VM=opensuse-kde
+SCREEN=Virtual-1
+SHOT_CMD=host
+FULLSCREEN_CMD='konsole --fullscreen'
+MAXIMIZE_CMD='~/lwe/maximize_kde.sh'
+WEM=app
+PREP='(setsid nohup kde-inhibit --power --screenSaver sleep 100000 >/dev/null 2>&1 &)'

+ 8 - 0
tools/linuxvm/profiles/opensuse-leap.sh

@@ -0,0 +1,8 @@
+VM=opensuse-leap
+SCREEN=Virtual-1
+SHOT_CMD=host
+FULLSCREEN_CMD='konsole --fullscreen'
+MAXIMIZE_CMD='~/lwe/maximize_kde.sh'
+WEM=app
+PREP='(setsid nohup kde-inhibit --power --screenSaver sleep 100000 >/dev/null 2>&1 &)'
+LOGIN_PASSWORD=lab

+ 6 - 0
tools/linuxvm/profiles/opensuse-xfce.sh

@@ -0,0 +1,6 @@
+VM=opensuse-xfce
+SCREEN=Virtual-1
+SHOT_CMD=host
+FULLSCREEN_CMD='bash -c "xterm -T lwe-fullscreen-test -e sleep 100000 & sleep 2; wmctrl -r lwe-fullscreen-test -b add,fullscreen; wait"'
+WEM=app
+PREP='xset s off -dpms; pkill -f "[x]fce4-screensaver"; pkill -f "[x]fce4-power-manager"; true'

+ 8 - 0
tools/linuxvm/profiles/popos-cosmic.sh

@@ -0,0 +1,8 @@
+VM=popos-cosmic
+SCREEN=Virtual-1
+SHOT_CMD=host
+FULLSCREEN_CMD='python3 ~/lwe/fullscreen_window.py'
+WEM=deb
+WEM_FLAGS=--disable-gpu-compositing
+# COSMIC: maximized windows only pause with --pause-on-maximized (wlroots style rule), not part of the default run
+LOGIN_PASSWORD=lab

+ 6 - 0
tools/linuxvm/profiles/ubuntu-gnome.sh

@@ -0,0 +1,6 @@
+VM=ubuntu-gnome
+SCREEN=Virtual-1
+SHOT_CMD=host
+FULLSCREEN_CMD='python3 ~/lwe/fullscreen_window.py'
+MAXIMIZE_CMD='python3 ~/lwe/fullscreen_window.py maximize'
+WEM=deb

+ 139 - 0
tools/linuxvm/release_check.sh

@@ -0,0 +1,139 @@
+#!/bin/bash
+# release_check.sh [--vm name]... [--candidate dir] [--app dir|.deb] [--no-overlay] - the release gate of
+# RELEASE_TESTING.md: every VM with a profile, one after the other, each from its golden disk (a throwaway overlay, see
+# `linuxvm.sh golden`), with guest_test.sh's checks (wallpapers, hotswap, pause on fullscreen, SIGKILL cleanup), the
+# frame checks, we_manager's install/launch/autostart (wem_check.sh) and update flow (update_check.sh). A failed check
+# is retried once. Writes reports/<date>/summary.md plus the screenshots and logs of every VM, exit code 1 when anything
+# failed. VMs are powered off afterwards, the overlay is thrown away (KEEP_VM=1 leaves the VM running to look at it).
+#   --vm name        only this profile (repeatable); default: every file in profiles/
+#   --candidate dir  folder with lwe-hints/ (the engine under test) copied over ~/lwe/lwe-hints in the guest
+#   --app path       we_manager's dist/linux-unpacked or a .deb; without it the we_manager checks are skipped
+#   --engine-tarball the candidate's portable tarball, served to we_manager as the new engine release (update_check.sh)
+#   --no-overlay     run on the VM's disk as it is (a VM without a golden disk is run like this anyway)
+# A profile (profiles/<vm>.sh) sets: VM, SCREEN (as --screen-root names it), SHOT_CMD (command with $SHOT_FILE, or
+# host), FULLSCREEN_CMD / MAXIMIZE_CMD (open a fullscreen / maximized window), WEM (deb | app | none, how we_manager is installed), WEM_FLAGS,
+# LOGIN_PASSWORD (typed at a greeter without autologin), PREP (guest command run once the session is up, e.g. keeps the screen from locking), EXTRA (function name run last,
+# gets the VM name; prints PASS/FAIL lines).
+HERE=$(cd "$(dirname "$0")" && pwd)
+LINUXVM=${LINUXVM:-$HOME/.local/share/linuxvm}
+vms=() candidate="" app="" overlay=1 tarball=""
+while [ $# -gt 0 ]; do
+    case $1 in
+    --vm) vms+=("$2"); shift ;;
+    --candidate) candidate=$2; shift ;;
+    --app) app=$2; shift ;;
+    --engine-tarball) tarball=$2; shift ;;
+    --no-overlay) overlay=0 ;;
+    *) sed -n '2,20p' "$0"; exit 2 ;;
+    esac
+    shift
+done
+[ ${#vms[@]} -gt 0 ] || for f in "$HERE"/profiles/*.sh; do vms+=("$(basename "$f" .sh)"); done
+
+report=$HERE/reports/$(date +%F)
+mkdir -p "$report"
+summary=$report/summary.md
+echo "# Release check $(date '+%F %H:%M')" > "$summary"
+[ -n "$candidate" ] && echo "Engine candidate: \`$candidate\`" >> "$summary"
+[ -n "$app" ] && echo "we_manager: \`$app\`" >> "$summary"
+total_status=0
+
+lv() { "$HERE/linuxvm.sh" "$@"; }
+sshv() { lv ssh "$VM" "$@" </dev/null; }
+
+wait_off() {
+    for _ in $(seq 45); do
+        [ -f "$LINUXVM/vms/$VM/qemu.pid" ] && kill -0 "$(cat "$LINUXVM/vms/$VM/qemu.pid")" 2>/dev/null || return 0
+        sleep 2
+    done
+    lv kill "$VM"; sleep 2
+}
+
+# run the checks of one VM, results as PASS/FAIL/SKIP lines on stdout
+run_checks() {
+    local out=/tmp/lwe-test
+    lv scp "$VM" "$HERE/guest_test.sh" lwe/guest_test.sh
+    lv scp "$VM" "$HERE/fullscreen_window.py" lwe/fullscreen_window.py
+    lv scp "$VM" "$HERE/maximize_kde.sh" lwe/maximize_kde.sh
+    sshv "rm -rf $out; mkdir -p $out"
+    local shots=""
+    if [ "$SHOT_CMD" = host ]; then "$HERE/host_shots.sh" "$VM" "$out" 900 >/dev/null 2>&1 & shots=$!; fi
+    sshv ". ~/sessenv; BEHAVIOR=1 SETTLE=${SETTLE:-25} LWE_ARGS='--screen-root $SCREEN' SHOT_CMD='$SHOT_CMD' FULLSCREEN_CMD='$FULLSCREEN_CMD' MAXIMIZE_CMD='$MAXIMIZE_CMD' ~/lwe/guest_test.sh"
+    [ -n "$shots" ] && wait "$shots"
+    local local_dir=$report/$VM/shots
+    mkdir -p "$local_dir"
+    scp -q -r -i "$LINUXVM/id_ed25519" -P "$(cat "$LINUXVM/vms/$VM/port")" -o StrictHostKeyChecking=no \
+        -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR "lab@127.0.0.1:$out/*" "$local_dir/" 2>/dev/null
+    local shot
+    if [ -f "$local_dir/baseline.png" ]; then
+        for shot in "$local_dir"/shot-*.png; do [ -f "$shot" ] && python3 -I "$HERE/check_frame.py" --baseline "$local_dir/baseline.png" "$shot"; done
+    fi
+    [ -f "$local_dir/hot-before.png" ] && python3 -I "$HERE/check_frame.py" --differ "$local_dir/hot-before.png" "$local_dir/hot-after.png"
+    return 0
+}
+
+for VM in "${vms[@]}"; do
+    unset WEM_FLAGS LOGIN_PASSWORD SCREEN SHOT_CMD FULLSCREEN_CMD MAXIMIZE_CMD WEM WEM_FLAGS PREP EXTRA SETTLE
+    # shellcheck disable=SC1090
+    . "$HERE/profiles/$VM.sh" || { echo "no profile for $VM"; continue; }
+    export WEM_FLAGS   # the we_manager scripts add them to its command line (COSMIC)
+    mkdir -p "$report/$VM"
+    log=$report/$VM/run.log
+    echo "== $VM $(date +%T)"
+    {
+        if [ "$overlay" = 1 ] && [ -f "$LINUXVM/vms/$VM/golden.qcow2" ]; then lv fresh "$VM"; fi
+        lv start "$VM"
+        ready=0 logged_in=0
+        for _ in $(seq 60); do
+            # a greeter without autologin (COSMIC): type the password once the VM answers
+            if [ -n "$LOGIN_PASSWORD" ] && [ $logged_in = 0 ] && sshv true 2>/dev/null; then
+                sleep 25; lv type "$VM" "$LOGIN_PASSWORD"; lv keys "$VM" ret; logged_in=1
+            fi
+            lv scp "$VM" "$HERE/sessenv.sh" lwe/sessenv.sh 2>/dev/null && sshv "bash ~/lwe/sessenv.sh" >/dev/null 2>&1 && { ready=1; break; }
+            sleep 5
+        done
+        if [ $ready = 0 ]; then echo "FAIL $VM: no desktop session within 5 minutes"; else
+            # a golden disk keeps what an earlier run left: we_manager's autostart entry and playlist, stray engines
+            sshv "pkill -x we-manager; pkill -x linux-wallpaper; rm -rf ~/.config/autostart/we-manager.desktop ~/.config/we-manager; true"
+            [ -n "$PREP" ] && sshv ". ~/sessenv; $PREP"
+            if [ -n "$candidate" ]; then
+                sshv "rm -rf ~/lwe/lwe-hints.new"
+                lv scp "$VM" "$candidate/lwe-hints" lwe/lwe-hints.new && sshv "rm -rf ~/lwe/lwe-hints && mv ~/lwe/lwe-hints.new ~/lwe/lwe-hints"
+            fi
+            sleep 20
+            run_checks > "$report/$VM/checks.txt" 2>&1
+            if grep -q '^FAIL' "$report/$VM/checks.txt"; then
+                echo "retrying the failed checks once"
+                sshv "pkill -f '[l]inux-wallpaperengine' 2>/dev/null; true"; sleep 5
+                cp "$report/$VM/checks.txt" "$report/$VM/checks-first.txt"
+                run_checks > "$report/$VM/checks.txt" 2>&1
+            fi
+            if [ -n "$app" ] && [ "${WEM:-none}" != none ]; then
+                # with the candidate's engine tarball the update check installs it (as a v99 release), we_manager's own
+                # checks then run on it instead of the last published engine
+                {
+                    ENGINE_TARBALL=$tarball "$HERE/update_check.sh" "$VM" "$app"
+                    SKIP_ENGINE_INSTALL=${tarball:+1} "$HERE/wem_check.sh" "$VM" "$app" "$SCREEN"
+                } > "$report/$VM/wem.txt" 2>&1
+            fi
+            [ -n "$EXTRA" ] && $EXTRA "$VM" > "$report/$VM/extra.txt" 2>&1
+            sshv "cat /tmp/lwe-test/engine-*.log 2>/dev/null | tail -n 200" > "$report/$VM/engine-tail.log" 2>&1
+        fi
+        if [ -n "$KEEP_VM" ]; then echo "KEEP_VM set: $VM stays up for a look"; else
+            sshv "sudo systemctl poweroff" >/dev/null 2>&1 || lv stop "$VM" >/dev/null 2>&1; wait_off
+            [ "$overlay" = 1 ] && [ -f "$LINUXVM/vms/$VM/golden.qcow2" ] && lv fresh "$VM"
+        fi
+    } > "$log" 2>&1
+    pass=$(cat "$report/$VM"/{checks,wem,extra}.txt 2>/dev/null | grep -c '^PASS')
+    failed=$(cat "$report/$VM"/{checks,wem,extra}.txt 2>/dev/null | grep '^FAIL'; grep '^FAIL' "$log")
+    {
+        echo; echo "## $VM"
+        if [ -z "$failed" ]; then echo "$pass checks passed."; else
+            echo "$pass checks passed, failed:"; echo; echo "$failed" | sed 's/^/- /'; total_status=1
+        fi
+        for f in "$report/$VM"/{checks,wem,extra}.txt; do grep -h '^SKIP' "$f" 2>/dev/null | sed 's/^/- /'; done
+    } >> "$summary"
+    echo "   $pass passed$([ -n "$failed" ] && echo ", FAILED")"
+done
+echo "report: $summary"
+exit $total_status

+ 4 - 3
tools/linuxvm/run_behavior.sh

@@ -1,14 +1,15 @@
 #!/bin/bash
-# run_behavior.sh <vm> <session screen name> <fullscreen command> - the behaviour phase of guest_test.sh on a running VM
+# run_behavior.sh <vm> <session screen name> <fullscreen command> [maximized command] - the behaviour phase of guest_test.sh on a running VM
 # (hotswap, pause on fullscreen, SIGKILL cleanup) with host side screenshots, then checks the hotswap pictures differ.
 HERE=$(cd "$(dirname "$0")" && pwd)
-vm=$1 screen=$2 fullscreen=$3
+vm=$1 screen=$2 fullscreen=$3 maximize=$4
 out=${OUT_DIR:-/tmp/lwe-test}
 "$HERE/linuxvm.sh" scp "$vm" "$HERE/guest_test.sh" lwe/guest_test.sh
 "$HERE/linuxvm.sh" scp "$vm" "$HERE/fullscreen_window.py" lwe/fullscreen_window.py
+"$HERE/linuxvm.sh" scp "$vm" "$HERE/maximize_kde.sh" lwe/maximize_kde.sh
 "$HERE/linuxvm.sh" ssh "$vm" "rm -rf $out; mkdir -p $out" </dev/null
 "$HERE/host_shots.sh" "$vm" "$out" 500 > /dev/null 2>&1 &
-"$HERE/linuxvm.sh" ssh "$vm" ". ~/sessenv; BEHAVIOR=1 WALLPAPERS= SETTLE=${SETTLE:-25} LWE_ARGS='--screen-root $screen' SHOT_CMD=host FULLSCREEN_CMD='$fullscreen' ~/lwe/guest_test.sh" </dev/null
+"$HERE/linuxvm.sh" ssh "$vm" ". ~/sessenv; BEHAVIOR=1 WALLPAPERS='${WALLPAPERS-}' SETTLE=${SETTLE:-25} LWE_ARGS='--screen-root $screen' SHOT_CMD=host FULLSCREEN_CMD='$fullscreen' MAXIMIZE_CMD='$maximize' ~/lwe/guest_test.sh" </dev/null
 wait
 local=$(mktemp -d)
 scp -q -r -i "$HOME/.local/share/linuxvm/id_ed25519" -P "$(cat "$HOME/.local/share/linuxvm/vms/$vm/port")" -o StrictHostKeyChecking=no \

+ 75 - 0
tools/linuxvm/update_check.sh

@@ -0,0 +1,75 @@
+#!/bin/bash
+# update_check.sh <vm> <app dir | .deb> - we_manager's update flow in a VM's desktop session against fake_github.py on
+# this host: an app release (the candidate's .deb with a newer Version) and an engine release (the portable tarball under
+# a newer tag). Checks that both updates are offered, the engine update installs, and for a .deb install that the app
+# update downloads, installs through polkit (a rule for the lab user stands in for the dialog) and the package version
+# changes. Other install kinds (an unpacked AppImage, Flatpak) are expected to only get the notice. Needs the session
+# running (sessenv) and the candidate's we_manager unpacked/installed the way wem_check.sh does.
+#   APP_DEB       .deb to serve as the new app release (default: the one next to the app dir's dist folder)
+#   ENGINE_TARBALL portable engine tarball to serve (default ~/.local/share/distro-rootfs/out/linux-wallpaperengine-kde-portable-x86_64.tar.gz)
+HERE=$(cd "$(dirname "$0")" && pwd)
+vm=$1 app=$2
+sshv() { "$HERE/linuxvm.sh" ssh "$vm" "$@" </dev/null; }
+status=0
+pass() { echo "PASS $1"; }
+fail() { echo "FAIL $1"; status=1; }
+cdp() { sshv ". ~/sessenv; cd ~/wem; NODE_EXTRA_CA_CERTS= timeout ${CDP_TIMEOUT:-90} python3 cdp.py \"$1\" 2>&1 | cut -c1-${2:-700}"; }
+
+work=$(mktemp -d)
+engine_tag=v99.0.$(date +%s)   # newer than whatever engine the VM has, a golden disk may hold an earlier run's
+deb=${APP_DEB:-}
+if [ -z "$deb" ]; then
+    for candidate in "$(dirname "$app")"/*.deb "$(dirname "$app")"/../*.deb; do [ -f "$candidate" ] && deb=$candidate && break; done
+fi
+engine=${ENGINE_TARBALL:-$HOME/.local/share/distro-rootfs/out/linux-wallpaperengine-kde-portable-x86_64.tar.gz}
+[ -f "$deb" ] || { echo "no .deb to serve as the new app release (APP_DEB)"; exit 2; }
+python3 "$HERE/bump_deb.py" "$deb" "$work/we-manager_0.9.9_amd64.deb" 0.9.9
+cp "$engine" "$work/linux-wallpaperengine-kde-portable-x86_64.tar.gz"
+cp "$engine" "$work/linux-wallpaperengine-generic-portable-x86_64.tar.gz"
+mkdir -p "$work/certs"
+python3 "$HERE/fake_github.py" "$work/certs" \
+    --release "WallpaperEngineLover/we_manager=v0.9.9:$work/we-manager_0.9.9_amd64.deb" \
+    --release "WallpaperEngineLover/linux-wallpaperengine-kde=$engine_tag:$work/linux-wallpaperengine-kde-portable-x86_64.tar.gz,$work/linux-wallpaperengine-generic-portable-x86_64.tar.gz" \
+    > "$work/fake.log" 2>&1 &
+fake=$!
+trap 'kill $fake 2>/dev/null; rm -rf "$work"' EXIT
+sleep 3
+kill -0 $fake 2>/dev/null || { cat "$work/fake.log"; echo "fake_github did not start (port 443?)"; exit 2; }
+
+sshv 'mkdir -p ~/wem'
+if [ -d "$app" ] && ! sshv "test -x ~/wem/$(basename "$app")/we-manager"; then   # the app is not on the VM yet: copy it like wem_check.sh
+    tar -C "$(dirname "$app")" -cf - "$(basename "$app")" | ssh -i "$HOME/.local/share/linuxvm/id_ed25519" -p "$(cat "$HOME/.local/share/linuxvm/vms/$vm/port")" \
+        -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR lab@127.0.0.1 'mkdir -p ~/wem && tar -C ~/wem -xf -'
+fi
+"$HERE/linuxvm.sh" scp "$vm" "$work/certs/ca.pem" wem/fake-ca.pem
+"$HERE/linuxvm.sh" scp "$vm" "$HERE/cdp.py" wem/cdp.py
+sshv 'grep -q "api.github.com" /etc/hosts || echo "10.0.2.2 api.github.com" | sudo tee -a /etc/hosts >/dev/null
+sudo mkdir -p /etc/polkit-1/rules.d
+printf "polkit.addRule(function(action, subject) { if (subject.user == \"lab\") return polkit.Result.YES; });\n" | sudo tee /etc/polkit-1/rules.d/49-lab-test.rules >/dev/null
+pkill -f "[w]e-manager" 2>/dev/null; true'
+sleep 2
+if [[ $app == *.deb ]]; then start="we-manager ${WEM_FLAGS:-}"; else start="~/wem/$(basename "$app")/we-manager --no-sandbox ${WEM_FLAGS:-}"; fi
+sshv ". ~/sessenv; export NODE_EXTRA_CA_CERTS=\$HOME/wem/fake-ca.pem; (setsid nohup $start --remote-debugging-port=9222 > ~/wem/app-update.log 2>&1 </dev/null &); sleep 25"
+[ "$(sshv 'pgrep -fc "[w]e-manager"')" -gt 0 ] && pass "we_manager starts" || { fail "we_manager did not start: $(sshv 'tail -3 ~/wem/app-update.log')"; exit 1; }
+
+out=$(cdp 'window.electronAPI.updates.setChecks({app: true, engine: true})' 1500)
+out=$(cdp 'window.electronAPI.updates.check()' 2500); echo "     $out" | tr '\n' ' ' | cut -c1-600; echo
+kind=$(echo "$out" | grep -o '"appInstall": "[^"]*"' | cut -d'"' -f4)
+echo "$out" | grep -q '"version": "0.9.9"\|"version": "v0.9.9"' && pass "app update 0.9.9 offered (install kind $kind)" || fail "app update not offered"
+if echo "$out" | grep -q "$engine_tag"; then pass "engine update $engine_tag offered"
+elif echo "$out" | grep -q '"engineInstall": null'; then echo "SKIP engine update offer: no engine installed through we_manager on this VM yet"
+else fail "engine update not offered"; fi
+
+if [ "$kind" = deb ]; then
+    out=$(cdp 'window.electronAPI.updates.installApp()' 1500); sleep 20
+    version=$(sshv 'dpkg-query -W -f="\${Version}" we-manager 2>/dev/null')
+    [ "$version" = 0.9.9 ] && pass "the .deb update installed (we-manager $version)" || fail "after installApp the package is $version: $out"
+else
+    echo "SKIP app install: install kind '$kind' only gets the notice"
+fi
+
+out=$(sshv ". ~/sessenv; cd ~/wem; timeout 400 python3 cdp.py 'window.electronAPI.lwe.installPrebuilt()' 2>&1 | cut -c1-300")
+if echo "$out" | grep -q '"installed": true'; then pass "engine update installed through the prebuilt install: $(echo "$out" | grep -o '"version": "[^"]*"')"; else fail "engine update failed: $out"; fi
+grep -c "GET" "$work/fake.log" | xargs -I{} echo "     {} requests reached the fake api.github.com"
+sshv 'pkill -f "[w]e-manager" 2>/dev/null; sudo rm -f /etc/polkit-1/rules.d/49-lab-test.rules; sudo sed -i "/api.github.com/d" /etc/hosts; true'
+exit $status

+ 68 - 0
tools/linuxvm/wem_check.sh

@@ -0,0 +1,68 @@
+#!/bin/bash
+# wem_check.sh <vm> <app dir | .deb> [screen] - we_manager in a VM's desktop session, driven over DevTools (cdp.py):
+# distro detection and the prebuilt engine it picks, install from the GitHub release, launch of a scene and a web
+# wallpaper, stop and kill all leaving nothing behind, autostart entry written. Needs the session running (sessenv).
+# The app dir is we_manager's dist/linux-unpacked (what an AppImage unpacks to), a .deb is installed with the
+# distribution's package manager first. Prints one PASS|FAIL line per check.
+# WEM_FLAGS adds command line flags for the app (COSMIC needs --disable-gpu-compositing in the VM).
+# SKIP_ENGINE_INSTALL=1 keeps the engine that is installed (update_check.sh leaves the candidate's there).
+HERE=$(cd "$(dirname "$0")" && pwd)
+vm=$1 app=$2 screen=${3:-Virtual-1}
+sshv() { "$HERE/linuxvm.sh" ssh "$vm" "$@" </dev/null; }
+status=0
+pass() { echo "PASS $1"; }
+fail() { echo "FAIL $1"; status=1; }
+cdp() { sshv ". ~/sessenv; cd ~/wem; timeout ${CDP_TIMEOUT:-90} python3 cdp.py \"$1\" 2>&1 | cut -c1-600"; }
+
+sshv 'mkdir -p ~/wem; pkill -f "[w]em/.*we-manager" 2>/dev/null; true'
+"$HERE/linuxvm.sh" scp "$vm" "$HERE/cdp.py" wem/cdp.py
+if [[ $app == *.deb ]]; then
+    "$HERE/linuxvm.sh" scp "$vm" "$app" wem/app.deb
+    if sshv 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y ./wem/app.deb >/tmp/wem-deb.log 2>&1'; then pass "the .deb installs"; else fail "the .deb did not install: $(sshv 'tail -3 /tmp/wem-deb.log')"; fi
+    start="we-manager ${WEM_FLAGS:-}"
+else
+    tar -C "$(dirname "$app")" -cf - "$(basename "$app")" | ssh -i "$HOME/.local/share/linuxvm/id_ed25519" \
+        -p "$(cat "$HOME/.local/share/linuxvm/vms/$vm/port")" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+        -o LogLevel=ERROR lab@127.0.0.1 'mkdir -p ~/wem && tar -C ~/wem -xf -'
+    start="~/wem/$(basename "$app")/we-manager --no-sandbox ${WEM_FLAGS:-}"
+fi
+
+# a Steam library like a real user has: the Wallpaper Engine assets and the workshop items
+sshv 'mkdir -p ~/.steam/steam/steamapps/common/wallpaper_engine ~/.steam/steam/steamapps/workshop/content/431960
+ln -sfn ~/lwe/assets ~/.steam/steam/steamapps/common/wallpaper_engine/assets
+for id in 1120596121 1078208425; do d=~/.steam/steam/steamapps/workshop/content/431960/$id; [ -L $d ] && rm $d; [ -d $d ] || cp -al ~/lwe/wp-$id $d; done'  # copies: the library scan skips symlinked folders
+
+sshv ". ~/sessenv; (setsid nohup $start --remote-debugging-port=9222 > ~/wem/app.log 2>&1 </dev/null &); sleep 25"
+[ "$(sshv 'pgrep -fc "[w]e-manager"')" -gt 0 ] && pass "we_manager starts" || { fail "we_manager did not start: $(sshv 'tail -3 ~/wem/app.log')"; exit 1; }
+
+out=$(cdp 'window.electronAPI.lwe.detectDistro()'); echo "     distro: $out"
+out=$(cdp 'window.electronAPI.lwe.prebuiltTarget()')
+if echo "$out" | grep -q '"supported": true'; then pass "prebuilt engine offered: $(echo "$out" | grep -o '"asset": "[^"]*"')"; else fail "no prebuilt engine offered: $out"; fi
+out=$(cdp 'window.electronAPI.lwe.listScreens()')
+if echo "$out" | grep -q "$screen"; then pass "screens found: $out"; else fail "screen $screen not found: $out"; fi
+
+if [ -z "$SKIP_ENGINE_INSTALL" ]; then
+    sshv 'rm -rf ~/.local/share/linux-wallpaperengine-kde'
+    out=$(sshv ". ~/sessenv; cd ~/wem; timeout 400 python3 cdp.py 'window.electronAPI.lwe.installPrebuilt()' 2>&1 | cut -c1-300")
+    if echo "$out" | grep -q '"installed": true'; then pass "engine installed from the release: $(echo "$out" | grep -o '"version": "[^"]*"')"; else fail "engine install failed: $out"; fi
+fi
+
+launch() { cdp "window.electronAPI.lwe.launch('$HOME_STEAM/$1', {screen: '$screen'})"; }
+HOME_STEAM=$(sshv 'echo $HOME')/.steam/steam/steamapps/workshop/content/431960
+for id in 1120596121 1078208425; do
+    out=$(launch "$id"); sleep 30
+    engines=$(sshv 'pgrep -fc "/[l]inux-wallpaperengine(\.bin)? "')
+    if echo "$out" | grep -q '"running": true' && [ "$engines" -gt 0 ]; then pass "$id launched from we_manager ($engines engine processes)"; else fail "$id did not launch: $out"; fi
+    cdp 'window.electronAPI.lwe.stop()' >/dev/null; sleep 5
+    left=$(sshv 'echo $(pgrep -fc "/[l]inux-wallpaperengine(\.bin)? ") $(pgrep -fc "[w]eb-helper")')
+    [ "$left" = "0 0" ] && pass "$id: stop leaves nothing behind" || fail "$id: after stop engines/helpers: $left"
+done
+launch 1078208425 >/dev/null; sleep 25
+cdp 'window.electronAPI.lwe.killAll()' >/dev/null; sleep 6
+left=$(sshv 'echo $(pgrep -fc "/[l]inux-wallpaperengine(\.bin)? ") $(pgrep -fc "[w]eb-helper")')
+[ "$left" = "0 0" ] && pass "kill all leaves nothing behind" || fail "after kill all engines/helpers: $left"
+
+cdp 'window.electronAPI.config.setAutostart(true, true, null)' >/dev/null
+entry=$(sshv 'cat ~/.config/autostart/we-manager.desktop 2>/dev/null | grep "^Exec="')
+[ -n "$entry" ] && pass "autostart entry: $entry" || fail "no autostart entry written"
+exit $status

+ 5 - 1
tools/package_release.sh

@@ -82,7 +82,7 @@ if [ "$portable" = 1 ]; then
         # xcb extensions Mesa and cairo use
         'libxcb' 'libxcb-(dri2|dri3|present|sync|xfixes|randr|shm|glx|xkb|render|xinput|composite|damage)'
         # audio and IPC client libraries, they load plugins from system paths
-        'libasound' 'libpipewire-0\.3' 'libdbus-1' 'libsystemd' 'libcap'
+        'libdbus-1' 'libsystemd' 'libcap'
         # what CEF and the system's GTK stack link themselves
         'libnss3' 'libnssutil3' 'libsmime3' 'libssl3' 'libnspr4' 'libplc4' 'libplds4' 'libcups' 'libatk-1\.0'
         'libatk-bridge-2\.0' 'libatspi' 'libpango.*' 'libcairo.*' 'libpixman-1' 'libgdk_pixbuf-2\.0' 'libgtk-3' 'libgdk-3'
@@ -99,6 +99,10 @@ if [ "$portable" = 1 ]; then
         'libkrb5.*' 'libk5crypto' 'libcom_err' 'libgssapi_krb5' 'libkeyutils' 'libSM' 'libICE' 'libOpenGL'
         # a bundled libva can't load newer system drivers; Ubuntu minimal may lack libva, but then has no drivers either
         'libva' 'libva-(drm|x11|wayland)'
+        # libmpv links PipeWire and ALSA; a desktop on PulseAudio only (openSUSE XFCE) has no libpipewire and the engine did not
+        # start, a minimal Debian XFCE no libasound.
+        # The system's copy wins where there is one, it loads the system's plugins
+        'libpipewire-0\.3' 'libasound'
     )
     fallback_re="^($(IFS='|'; echo "${fallback_libs[*]}"))\.so(\..*)?$"