Turn off the touchscreen when a pen or stylus comes close to the screen.
Turn off the touchscreen when a pen or stylus comes close to the screen.
You can adjust the touch sensitivity settings to disable touch input when the pen is detected. Check your system preferences or use a script to modify the Wayland settings accordingly.
Right, I can't write the solution to this here, but I can tell you where too look. This detection is going to show up in udev if your laptop is configured correctly, so udevadm monitor run in a terminal is going to show what udev knows about "seeing the pen above the screen" or not. At this point I'd start scripting /usr/bin/xinput to find, identify, and disable the touchpad, but you are using wayland, so you'll need someone familiar with wayland to help with that. Once you have a script(s) to switch the touchpad on and off you just need to tie it to the events generated in udev when you move them pen in/out of range by adding custom rules in /etc/udev/rules.d/ This isn't newbie stuff, but it's totally doable (assuming wayland is capable of disabling/re-enabling the touchpad), and a worthy endeavour.
Udev appears to be the best approach for recognizing the pen above the display. The main challenge now is figuring out how to turn off the touchscreen using Wayland.
I discovered a script that lets you switch touch input on Wayland, which I can adapt for my needs. I tried udevadm monitor but it only displays brightness changes, not any other functionality. This is unexpected since I previously used udevadm to detect tablet mode. Do you know how to fix udevadm monitor so it works correctly? @Ralphred
The only option is to test it by inserting or removing a device. If it isn't a hotplug event, you should search for Wayland's version of `xev` (X Event Viewer) to see if the proximity event is logged there. Unless you're familiar with a tool that automates scripting on specific events, you'll likely need to create background scripts yourself.