5

Can anyone please tell how to use an Android device as a second monitor to extend the display?

I found an app called "spacedesk", but it is only available for windows.

Can anyone suggest a method to do so or install the app?

Alex Stragies
  • 5,857
  • 2
  • 32
  • 56
ricfr
  • 43
  • 1
  • 5
  • related question: [VNC-Server as a virtual X11 monitor to expand screen](https://unix.stackexchange.com/questions/156412/vnc-server-as-a-virtual-x11-monitor-to-expand-screen/329059#329059) – Alex Stragies Jun 28 '20 at 14:53

2 Answers2

3

There are three steps to doing what you want:

  1. Configure one of your unused video-card outputs to "display" part of your desktop.

  2. Run a VNC server on just the part of the screen that is "displayed" on the missing monitor.

  3. View the VNC server on your android client.

I'll go through each of these in turn. #1 is the trickiest, because it depends on the type of video card you have. I have an NVIDIA card, so for me it requires the following:

  • In the Section "Device" section of my xorg.conf file, I place the following:

    Option "ConnectedMonitor" "DP-0,DP-4"
    

    The documentation suggests you can also do this in the "Screen" section, but that doesn't seem to work in reality. Note also that the names DP-0 and DP-4 come from xrandr output. It doesn't seem to work to use virtual daisy-chained displayport, so if you have problems using consecutive DP-0 and DP-1, just try something farther away. The DP-* names are aliases, and you can find canonical names in your /var/tmp/Xorg.0.log file. On my system, the canonical names are DFP-1 and DFP-5.

    I've read that this could be even easier with intel video than NVIDIA, but don't have first-hand experience.

  • In the Section "Screen" section, I put:

    Option "nvidiaXineramaInfoOrder" "DP-0,DP-4"
    Option "metamodes" "DP-0: 2560x1440+0+0, DP-4: 2560x1440+2560+0"
    

For #2, I've successfully used two options: x11vnc and the program x0vncserver that comes with tigervnc. In the first case, your command might look like this (once you've set a password with vncpasswd, which comes with tigervnc):

x11vnc -rfbauth "$HOME/.vnc/passwd" -N -xinerama -clip xinerama1 -display :0 -forever -bg

Note x11vnc will suggest use of the -ncache option, which is okay, but somehow my VNC client shows the pixel cache by default which is confusing. You can zoom the client to hide the pixel cache, or just not use -ncache. For extra security, also consider adding -viewonly. (I don't use this because I use a stylus for input on my android device.)

The tigervnc option means running a command like this:

x0vncserver -rfbauth "$HOME/.vnc/passwd" -Geometry 2560x1440+2560+0 -rfbport 5900 -display :0 &

For #3, there are a variety of free/libre and non-free Android VNC clients. For free ones, you can check out AndroidVNC and MultiVNC. Personally I use the proprietary Remotix VNC client because it's the only one I've found that sort-of works with a stylus, but if you just want a display, I think the free versions are better.

user3188445
  • 5,107
  • 3
  • 21
  • 38
2

You could use the android device(s) as (additional) X-Server(s):

  • Install e.g. XSDL Xserver on your android device(s), and launch it.
  • Set DPI/Font size for that Xserver.
  • Optional, but better: Install adb on your computer
  • Optional, but better: Connect device via USB to avoid Wifi transfers, you can check connected devices via adb devices
  • Optional, but better: adb forward tcp:6100 tcp:6000
    (For additional devices, increment 6100 to 6101, etc)
  • Set your Display variable:
    • If you did the optional part: export DISPLAY=:100
    • If you didn't: export DISPLAY=<Android-Wifi-IP>:0
  • Launch an application to display there: e.g. a xterm+tmux, or an emacs-client
  • Now you use from your package manager, or from github, to send input input events: x2x -to :100 -west. (This will "teleport" your input devices to the other screen once you hit the left border of your main screen, and back)

Unlike the other answer, this solution does not limit the number of external displays you can use.

XSDL Xserver also includes a pulseaudio server, so that can use the android device as additional speakers. Install IPWEBCAM, if you also want to use your tablet/phone as a(n additional) webcam.

kworr
  • 405
  • 3
  • 7
Alex Stragies
  • 5,857
  • 2
  • 32
  • 56