May 24, 2024

KDE developer David Edmundson has demoed a brand new characteristic being included in Plasma, one that can permit seamless restoration from crashes.

The Linux world is within the midst of a transition from the outdated X11 show server to the newer Wayland protocol. On the identical time, KDE is transitioning the Plasma desktop setting (DE) and apps to model 6 of the underlying Qt toolkit.

Collectively, these adjustments are offering a singular alternative for KDE builders to construct in seamless crash restoration when the show server crashes, as Edmundson explains in his weblog:

Proper now in case you restart pulseaudio your sound would possibly lower out, restart NetworkManager and also you lose your wifi, restart an X11 window supervisor and your decorations disappear.

However inside a second it’s all again to regular precisely the place you left off with every little thing recovering tremendous.

This isn’t true for show servers. If X11 restarts you’re again on the login immediate. All drafts misplaced, video games unsaved, work wasted.

Edmundson particulars how QtWayland 6.6 offers a method to overcome this subject:

The answer for this? As a substitute of exiting when the compositor closes, merely…don’t!

If we might hook up with a brand new compositor we simply have to ship the correct quantity of knowledge to convey it in sync and notify the applying code of any adjustments to convey this in sync.

For Qt purposes all this info is dealt with within the backend, within the Wayland Qt Platform Abstraction (QPA).

Qt already has to deal with screens and enter gadgets being eliminated, clipboards being revoked and drag and drops cancelled. Supporting an entire reset isn’t introducing any new work, we simply should set off all of those actions without delay, then reconnect to the newly restored compositor and restore our contents.

Functions already should assist all of those occasions too in addition to deal with callbacks to redraw buffers. There’s no adjustments wanted at an utility code degree, it’s all executed as transparently as doable.

Edmundson says there are different potential advantages down the highway, together with the flexibility to seamlessly carry out updates in place that may usually require logging out and again in.

The KDE builders are additionally upstreaming these adjustments so different toolkits can use them, with “pending patches for GTK, SDL and even XWayland, with key components of SDL merged however disabled already.”

The characteristic is a major enchancment for the Linux desktop and can hopefully be broadly adopted throughout desktops and distributions.