Revamping Plasma Mobile Navigation Gestures
A few months ago I was kind of toying with the idea to start contributing to Plasma Mobile because I was getting increasingly fed up with Android and I realized if GNU/Linux Mobile was going to be my daily driver before I need to buy a new phone I better help out.
Then, after a few trivial commits I've seen that for the Plasma 6 release the navigation gestures were (at least temporarily) turned off - and since I am a very big fan of navigation gestures because they are objectively the best way to interact with a phone I just couldn't have that and I went about fixing them.
A bit of context
Why did the gestures even break by the upgrade to Plasma 6? Well, in Plasma Mobile 5 the navigation gestures were implemented in quite a hacky way - an invisible panel at the bottom screen edge that captured finger touches and handled the gesture and visual effect. While this worked this required a bunch of data moving around from KWin to the shell to show the window thumbnails which is unnecessary overhead.So for Plasma 6 Devin Lin rewrote the entire task switcher, including the navigation gestures, to be a KWin effect which should make it perform better and use more of its infrastructure to need less bespoke code.
This went mostly quite smoothly, with few hiccups along the way. Unfortunately one of those hiccups was gestures (which now moved to KWin's EffectTogglableTouchBorder
interface) simply not working anymore.
Fixing gestures
The fix was surprisingly simple: In the constructor for setting up the task switcher, including all shortcuts and gestures for it, thereconfigure
function was simply never called which in turn meant the KWin::EffectTogglableTouchBorder::setBorders
function was never executed. As you might imagine "setting the border" is quite a crucial part of having working gestures and one function call later gestures worked again!