Back to list2023-218

Fix Delete Desktop button in Overview Effect

If you are using the KDE/Plasma desktop you may use the overview desktop effect. This effect is a staple of my workflow as it makes navigating many desktops a breeze.

Yet this effect has one deadly flaw. All it takes to delete a virtual desktop is a single click onto the delete desktop button. This leads to countless accidental deletions of desktops.

This problem only amplifies when you use vertical screens.

To work around this little problem you can edit the effect file to respond only to double clicks.

The following command does the trick (tested on Arch Linux):

sudo sed -i 's/onClicked\: delegate\.remove\(\)/onDoubleClicked\: delegate\.remove\(\)/' /usr/share/kwin/effects/overview/qml/DesktopBar.qml

A bit more detail

The effect is part of the kwin project. The file of interest is /usr/share/kwin/effects/overview/qml/DesktopBar.qml.

The relevant line is:

onDClicked: delegate.remove()()

which we are replacing with:

onDoubleClicked: delegate.remove()()

The fix presented here is just a workaround and will be overwritten once you run an update of kwin including the effect. Yet sending this change upstream would probably cause a lot of confusion amongst users. Making this an option might be a bit smarter.

I packed the line into a simple shell script that you can find in this snippet and run it after every update. Works miracles for the moment.