Smartphone/tablet as second monitor for linux

Simple cli tool to create virtual monitor for Linux. You can use any remote desktop software(vnc,teamviewer ..) to connect to that monitor.

  • This tool uses xrandr so it will not work with wayland or if your GPU does not support xrandr commands.

Review

Setup

The hard way (not that hard :3)

This script is example of Nexus 7 2013 as second monitor.You may need to change 1920 and 1200 to the resolution of your tablet screen. You may also need to change LVDS1 if the default monitor's name is different.

gtf 1920 1200 60 | grep -oP "\".+"

The output will be something similar to "1920x1200_60.00" 108.88 1920 1360 1496 1712 1200 1025 1028 1060 -HSync +Vsync. Copy everything into the next command.

xrandr --newmode "1920x1200_60.00" 108.88 1920 1360 1496 1712 1200 1025 1028 1060 -HSync +Vsync

xrandr --addmode VIRTUAL1 1920x1200_60.00

xrandr --output VIRTUAL1 --mode 1920x1200_60.00 --primary --right-of LVDS1

The easier way

  • Clone this git
    git clone https://github.com/ChipCE/Smartphone-tablet-as-second-monitor-for-linux
  • Change directory
    cd Smartphone-tablet-as-second-monitor-for-linux
  • Run install script as root and follow the instruction.
    sudo ./install.sh
  • run vmon setup to setup virtual monitor profile.
    This command need to be executed each time X server start.
  • run vmon enable to enable virtual monitor. If success, you will able to se an additional monitor in "display" setting.
  • Connect to host system using Teamviewr, VNC or any screen sharing program.
  • To disable vmon, run vmon disable

Configuration

vmon configuration

  • vmon config file are saved in /home/$USER/.vmon
  • You can add more custom resolution into resoluton.conf file.
  • Default resolution and default display(the main output display) can be set in vmon.conf.For more information about ouput displays and supported resolution profiles, run xrandr in terminal.

Other configuration (teamviewer)

  • To show cursor in tablet screen, enable "show remote cursor" in teamviewer(tablet).
  • To connect with wlan, enable "incomming lan connection" in Extras > Options(linux).
  • To connect via USB cable, you need adb installed and forward Teamviewer port with adb forward or enable USB Tethering in android setting.
  • To turn-off VIRTUAL1 output, run xrandr --output VIRTUAL1 --off

Troubleshooting

1.VIRTUAL1 not found error

If you get the output VIRTUAL1 not found error, create 20-intel.conf file:
sudo nano /usr/share/X11/xorg.conf.d/20-intel.conf Add the following configuration information into the file:

Section "Device"
    Identifier "intelgpu0"
    Driver "intel"
    Option "VirtualHeads" "2"
EndSection

and reboot.

2.Teamviewer error : Not ready. Please check your connection error

  • Check if teamviewerd has been started, if not start it
    systemctl start teamviewerd
  • install libicu and restart teamviewer.