Skip to content

PI(M)P Your Clock

Monday, 30 June 2025  |  Kai Uwe Broulik

You may have read about my new-found fondness for Plasma’s Clock app. Following the development of a “Picture in Picture” protocol for Wayland, I remembered how I once saw someone put up a little timer window during a lunch break while screen-sharing a presentation. I figured, I wanted that, too!

KClock main application window on the page of a “Take a break” timer with a message “This timer is in Picture-in-Picture mode”. A separate small popup window in the bottom right corner containing the timer, a circle to indicate progress, and some controls (add a minute, pause, reset, return to app, and close)
KClock showing a timer popped out in a PIP window

A key difference between X11 and Wayland is that Wayland is descriptive, not prescriptive. For example, a drop down menu under X11 is a window with no border that is placed in a very specific location determined by the application. It then grabs all the input so that up and down arrows work and clicking outside will dismiss it. That also means that global shortcuts won’t work while the menu is open. You can’t take a screenshot of it, you can’t even lock your screen. In 2025, this is embarrassing.

Under Wayland on the other hand, such a menu is an XDG Popup. The application tells the compositor what button it came from and what to do when it can’t fit (flip to the other side, scroll, etc). The compositor then gets to decide where to put the menu (not crossing display boundaries, for example) and to make sure it goes away when you click elsewhere or switch to a different application.

This also means that an application is a lot more restricted when it comes to – let’s say – creative window behavior. Take the picture-in-picture feature for example: an application can’t just decide to keep its window on top of everyone else. Normally, that’s a good thing! But it likewise prevents implementing a little overlay video player in your Web browser under Wayland. Enter xx-pip-v1.

A handsome bearded person giving a presentation, waving his arm in front of a black board. KClock stopwatch popup in the bottom right corner, showing total time, lap time, and a “Pause” and “Lap” button
Measure lap time while watching a fantastic talk

It’s a protocol very similar to XDG Shell but instead of managing desktop-y windows and popups, it creates floating picture-in-picture windows. KWin recently gained support for it. As indicated by the “xx” prefix it’s an experimental protocol and therefore guarded by a KWIN_WAYLAND_SUPPORT_XX_PIP_V1 environment variable. As with most protocols, having a test case is nice but a proper application making use of it will uncover gaps and oversights in the protocol much better. Therefore, I took the opportunity to allow KClock to pop out timers and the stopwatch into a little PIP window.

While it can and does take time to sketch a Wayland protocol to realze a new use case, the end result will be generally better than anything we had before. Rather than an application deciding how PIP should behave, the compositor is in full control and subsequently you, the user. We could offer an option for which corner the window should be placed by default, or to not show it at all, and do it consistently for all applications.

Many thanks to Vlad Zahorodnii for his work on the xx-pip-v1 protocol and whose demo application the KClock implementation is based on and to David Edmundson for implementing window move/resize in the PIP window.