Turn Your Tablet Or Phone Into A Graphic Tablet / Touch Screen For Your Desktop With Weylus
Weylus is a tool similar to the macOS & iPad Sidecar feature, which turns your tablet or mobile phone into a graphic tablet / touch screen, and allows mirroring or extending the desktop screen to a phone or tablet. It's available for Linux, Microsoft Windows and macOS.
To use a phone or tablet as a graphic tablet / touch screen, all you need is to install Weylus on your desktop, have a modern web browser (e.g. Firefox 80+) running on your phone or tablet, and have both the desktop and tablet / phone on the same network.
Weylus lets you control your mouse with a tablet or phone, mirror the desktop screen to a tablet, and send keyboard input, all with optional hardware-accelerated video encoding (on Linux, VAAPI and NVENC are available; for macOS there's only Videotoolbox, while on Windows it can use NVENC or Microsoft's MediaFoundation).
For Linux, Weylus comes with even more features. It allows using a stylus / pen (supports pressure and tilt), multi-touch, capturing specific windows and only drawing to them, and you can use the tablet or phone as a second screen (extend your current desktop screen). Screen mirroring is also faster if you're using Linux.
It's also worth noting that Weylus works best with X11, but it does have experimental Wayland support. Things that don't work on Wayland include input mapping for windows, displaying proper window names, and capturing the cursor.
To use Weylus on Wayland, you'll need to install PipeWire and xdg-desktop-portal (GStreamer is also needed, but that should already be installed; FFmpeg is also used, but you don't need to install it since it's shipped with Weylus). You'll also need xdg-desktop-portal-gtk for GNOME, xdg-desktop-portal-kde for KDE Plasma, and xdg-desktop-portal-wlr for wlroots-based compositors (e.g. Sway).
Related: Deskreen Makes Any Device With A Web Browser A Second Screen For Your Computer
The Weylus desktop user interface (image above) is basic, with only a few options for setting the bind address, port and websocket port, and the access code used to connect to Weylus. You also have options for autostarting Weylus, enable Wayland support, as well as NVENC and VAAPI hardware acceleration options on Linux (disabled by default).
To connect to Weylus using your smartphone or tablet, the application displays a URL you need to enter in a web browser on your phone / tablet, as well as a QR code you can scan to easily connect to it.
When visiting this URL on your phone or tablet, you'll get some more options (image above). On Linux, you'll be able to choose if you want to capture the whole desktop, a particular monitor, or a window, enable/disable video, capture cursor, mouse, stylus, touch and uinput, set the minimum pressure, and set the maximum video resolution and minimum frame rate interval
In my test, using Weylus on Ubuntu 21.04 and iPad 10 Pro with Xournal++ worked great for the most part with X11 - sometimes the stylus missed some strokes though. However, it did not work properly under Wayland. The stylus and multi-touch worked using Wayland, but the desktop was not mirrored properly and all I've got was a black screen.
You might also like: Control Android Devices From A Desktop With scrcpy
Download Weylus
Weylus is available for Linux, macOS and Windows, and you'll find binaries for all 3 on its releases page. On Linux you'll find DEB packages (for Debian / Ubuntu and Linux distributions based on these), and a generic archive that should work on any Linux distribution.
Weylus is also available on AUR for Arch Linux / Manjaro users: weylus | weylus-bin.
If you're using a firewall, make sure ports 1701 and 9001 are open. It's also very important to note that to enable stylus and multi-touch support, /dev/uinput
needs to be writable by Weylus - see this page for how to do this.
You might like: Assign Actions To Touchpad Gestures On Linux With Touchegg - it also supports swipe and pinch multi-touch gestures.