Implement picture-in-picture mode

Making use of xx-pip-v1 Wayland protocol.

This allows to "pop out" the stopwatch page or a timer, similar to how it's possible with a video in a web browser. Clicking "return to app" returns back to the page that was popped out.

PipHandler singleton manages the PIP contents. It contains a StackView that anyone can push components into to display as PIP window, which also ensures the PIP content stays alive after leaving the page.

Co-Authored-By: Vlad Zahorodnii vlad.zahorodnii@kde.org

Co-Authored-By: David Edmundson kde@davidedmundson.co.uk


Thanks to @vladz on whose pip test app in kwin this is based on and @davidedmundson for doing the window resize/move stuff

Screenshot_20250627_134352

Screenshot_20250627_134404

A video probably does it more justice 😄

Screencast_20250627_134013

You need to enable xx-pip-v1 in KWin by running it with KWIN_WAYLAND_SUPPORT_XX_PIP_V1=1. When the compositor doesn’t support it, the button to “pop out” is hidden.

There’s a few open issues and todos but for the most part it’s working great:

  • Look into X11 maybe ;)
  • There seems to be no way to set a minimum size
  • I also seem to be unable to properly change the window size (i.e. restore the default size I had) once the window has been resized by the user once
  • requestActivate of the main window from the PIP window (“return to app”) doesn’t work, just blinks in taskbar. Do I need to request an xdg activation token manually?
  • Resize cursors on the edges a bit annoying to use
  • Resizing the window is laggy/jumpy, kwin issue?
  • The HoverHandler in the pip window (that makes the controls show) sometimes gets stuck in hovered state when leaving the window with the mouse cursor quickly

Merge request reports

Loading