A year ago, I switched to Linux from Windows, and I am happy with it. I had always used a VM to run Linux before, but I am finally getting to know how things work in Linux after natively installing it. There are many Linux alternatives for Windows programs, so I normally have no problem using Linux programs.
The only thing I missed about Windows is iPad dual monitor apps like Duet Display. A little bit of searching the web led me to some solutions like Aditya’s post and a thread in Arch Linux forum, so I was able to make my iPad a second display. However, the solutions in the post required to input some command manually every time I enable dual screen and don’t work nicely as-is.
As I tired typing commands by hand and memorizing them, I decided to write my own script
ipad_monitor.sh. This script is still far from “automagically” but it works mostly out of the box. All you need to do is changing
HEIGHT at the beginning of the code. Since it uses VNC to connect to an iPad, it also works with any tablet and computer with a VNC client. Here it goes:
So, what the script does is 1. to parse arguments to set a proper resolution, 2. add a display mode using
XRandR, 3. Output it next to a primary display, 4. and run
x11vnc to transmit the screen through VNC.
How to use
sudo apt-get install x11vnc.
HEIGHTin the script to change the resolution.
- Figure out your local IP address using
- Run this script. Addtional arguments are self-explanatory. Example arguments:
./ipad_monitor.sh -r # or --right. Second screen appears right to the primary monitor. ./ipad_monitor.sh -l # or --left ./ipad_monitor.sh -a # or --above ./ipad_monitor.sh -b # or --below ./ipad_monitor.sh -r -h # or --hidpi. HiDPI mode. It doubles the resolution. ./ipad_monitor.sh -r -p # or --portrait. Portrait mode. ./ipad_monitor.sh -l -p -h # Left, portrait mode, and HiDPI mode.
- Connect your iPad using your favorite VNC app. IP address is :
I use an i5-4210M laptop as a VNC server and iPad Pro 2nd Gen as a client. Testing is done on a local area network, meaning that the VNC server and client are connected to the same home router using WiFi, and with VNC screen both at 1368x1024 and 2736x2048 with full colors.
Just like I do daily with a second screen, I tried using a web browser on the VNC screen. Although it did not work as smoothly as paid dual screen apps or Windows RDP, it worked pretty fine. It showed the browser window almost instantly and the screen update rate was not bad when I fast scrolled up and down the browser. The screen shutterEverything worked without a big issue.
Note that the performance depends on routers. I also tried it on a public WiFi and it was almost useless. If this is the case, I would suggest using the offline solutions mentioned in QnA below. Actually the offline solutions usually perform better than connecting via a home router.
Regarding resource usage,
x11vnc uses very few RAM but constantly uses 2% to 5% while showing a still image. Its CPU usage occasionally spikes up to 40% while scrolling the browser, so it obviously drains laptop battery.
That’s it. I hope someone finds it useful.
How I can use it offline?
You may want to connect them directly using WiFi hotspot. There are two ways:
- Create a WiFi hotspot on your laptop. You can do this simply using
sudo create_ap wlp0s0 wlp0s0 _Your_SSID_ _Your_Password_. Note that not all hardware support this feature.
- Enable “Personal Hotspot” on your tablet and connect your laptop. WARNING: It will drain your mobile data, although I personally checked my iPad that it doesn’t use mobile data for VNC connection.
In either way, use a proper local network IP managed by the laptop/iPad.
This script heavily relies on an x11 utility,
XRandR. Unfortunately, Wayland dropped support for XRandR screen control. And there doesn’t seem to be an
XRandR command alternative for Wayland. It looks like Wayland doesn’t want user apps to change monitor resolution (but…why?). So I don’t know how to do the same thing using simple bash scripts for now.
How to set a VNC password?
You can set a password by editing the last
x11vnc command in the script file. See this Wiki article to set up a password.