#Laptop with Ubuntu 18.04, Intel HD graphics
#1. Get some information
#--------------------------
#In your computer install
#a VNC server (as for example x11vnc)
sudo apt install x11vnc
#In Your android device install, freebVNC from Google store
#back in ubuntu terminal, put the following command,
xrandr
#This shows you the available displays. For example the output from above command
#shows that the current display is eDP-1 with a resolution of 1366x768 with 60.00Hz
#reflesh rate. HDMI-1, DP-1 and HDMI-2 are avaible for extending the display, as shown
#in the ouput below:
Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192
eDP-1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 309mm x 173mm
1366x768 60.00*+ 48.00
.
.
.
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
#2. make a new virtual monitor
#-----------------------------
#First you must know the resolution of your android device,
#if you not sure what the resultion, you can use can visit
#this website:
#https://whatismyandroidversion.com/
#In this case it was for example 1024x768.
#after you get the resolution, type the following command,
gtf 1024 768 60
#Where 60 is the refresh rate, this created something called
#"modeline" which set the resolution for your android device.
#The output of the command above is:
1280x800 @ 60.00 Hz (GTF) hsync: 49.68 kHz; pclk: 83.46 MHz
Modeline "1024x768.00_60" 83.46 1280 1344 1480 1680 800 801 804 828 -HSync +Vsync
#From above output, copy everything after Modeline, that is:
"1024x768.00_60" 83.46 1280 1344 1480 1680 800 801 804 828 -HSync +Vsync
#Create a new mode from the line above, like in the following,
xrandr --newmode "1024x768_60.00" 83.46 1280 1344 1480 1680 800 801 804 828 -HSync +Vsync
#Add this new mode to an unused output port. HDMI-1(since HDMI-1 is one of unused port)
#in this case,
xrandr --addmode HDMI-1 1024x768_60.00
#after the above step, let’s enable HDMI-1 and
#move it to the right(or left) of the default display (eDP-1),
xrandr --output HDMI-1 --mode 1024x768_60.00 --right-of eDP-1
#alternatively you can move it left,
xrandr --output HDMI-1 --mode 1024x768_60.00 --left-of eDP-1
#lastly start the VNC server:
x11vnc -clip 1024x768+0+0
# You ready to extend your screen to android,
3. Extending the screen to android,
----------------------------------
#from unbuntu terminal get ip address of your PC, using the following
ip a
#The output will be something like:
inet 127.0.0.1/8 scope host lo
...
#if you using hotspot without internet.
#Now lunch freebVNC you download from google store.
#then enter the address:127.0.0.1 and port 5900(defalt port for x11vnc)
#save and click the created in display in freebVNC to connect.