How does KDE detect tablet/touch mode?

On my Acer Spin 1 tablet mode is not recognized/honored by KDE (Fedora 40, Plasma 6.1, as well as openSUSE Leap 15.6, Plasma 5.27).

Screen rotation in KDE works (also monitor-sensor reporting changes in screen orientation).

What I want is to enable rotation only when the display is flipped around.
But setting Orientation to “Automatic” > “Only when in tablet mode”, (under Display Configuration) does not work, i.e. no screen rotation happening at all after flipping (though keyboard and mouse seem to be properly disabled).

Same applies to the setting Touch Mode to “Automatically enable as needed”.

Is there any way to troubleshoot this? I guess that it might be kernel related.

I think it relies on iio-sensor-proxy do you have that installed?

https://wiki.archlinux.org/title/Tablet_PC#With_a_KDE_module

Yup, monitor-sensor is part of that package :wink:

Thing is that orientation is reported correctly (via iio-sensor-proxy), but not that the device has switched into tablet mode when flipping the lid around.

I want Plasma to ignore orientation when not in tablet mode, as well as having a normal title bar size.
When flipping the lid, it should obey orientation and use the thicker title bar for touch gestures.

That’s why I set:
Display and Monitor > Display Configuration: Orientation
(•) Automatic
Only when in tablet mode

and

Workspace Behavior > General Behavior: Touch Mode
(•) Automatically enable as needed

KWin finds out if you’re in tablet mode or not with a tablet mode switch from libinput. To test it, you can run

sudo libinput debug-events

and when you flip the tablet around, it should print an event for that switch. If it doesn’t, then it’s not working on a driver level

1 Like
chris@localhost:~> sudo libinput debug-events
-event4   DEVICE_ADDED            Power Button                      seat0 default group1  cap:k
-event1   DEVICE_ADDED            Video Bus                         seat0 default group2  cap:k
-event5   DEVICE_ADDED            Acer Wireless Radio Control       seat0 default group3  cap:k
-event2   DEVICE_ADDED            Lid Switch                        seat0 default group4  cap:S
-event3   DEVICE_ADDED            Power Button                      seat0 default group5  cap:k
-event8   DEVICE_ADDED            04F3224A:00 04F3:255A             seat0 default group6  cap:t  size 248x140mm ntouches 10 calib
-event11  DEVICE_ADDED            04F3224A:00 04F3:255A Stylus      seat0 default group6  cap:T  size 256x144mm left calib
-event12  DEVICE_ADDED            06CB0001:00 06CB:CD3F Mouse       seat0 default group7  cap:p left scroll-nat scroll-button
-event13  DEVICE_ADDED            06CB0001:00 06CB:CD3F Touchpad    seat0 default group7  cap:pg  size 102x57mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on dwtp-on
-event0   DEVICE_ADDED            AT Translated Set 2 keyboard      seat0 default group8  cap:k
-event6   DEVICE_ADDED            Acer WMI hotkeys                  seat0 default group9  cap:k

No additional lines generated when flipping the display.
So, that means, it’s a kernel (driver) issue, then?

Yes. Could be in libinput as well, but it’s most likely a kernel problem

The sensor in my lip was acting a little buggy. Thankfully, I found a script that lets you toggle tablet mode manually. Just search a-script-to-toggle-tablet-mode-or-touch-mode-on-plasma in the forum.

I only had to change KDE_VERSION in the script to 5 in my case.