Skip to content

Instantly share code, notes, and snippets.

@thecmdrunner
Last active December 8, 2022 07:58
Show Gist options
  • Select an option

  • Save thecmdrunner/8101c21a1e59f8f76c4c239c8cc3bf6d to your computer and use it in GitHub Desktop.

Select an option

Save thecmdrunner/8101c21a1e59f8f76c4c239c8cc3bf6d to your computer and use it in GitHub Desktop.
Linux: Using a Tablet as a secondary display

This guide uses Deskreen on Pop! OS 20.04

1. Virtual Display Output

Deskreen can share any display as long as it is detected via xrandr, but to be able to have a display show up exlusively on a secondary device, there needs to be an unused display output. Most GPUs and laptops have additional display-out ports that can be used. But in my case, I use my TV as a primary display, while casting my laptop's screen to my phone, as my laptop's display doesn't work anymore.

Add a Virtual Output

The idea is to make the system think that a display is connected to an unused display-out port (HDMI / DVI / DisplayPort) and sharing its contents to our secondary device via Deskreen. To do so, follow along:

A. Open up terminal app and enter xrandr --listmonitors to check out all available display ports.

The output will be something like this.

Monitors: 2
 0: +*HDMI-A-0 1920/575x1080/323+0+0  HDMI-A-0
 1: +eDP 1366/344x768/193+1920+0  eDP

As you can see, I have total 2 display outputs, HDMI-A-0 (HDMI Port) and eDP (laptop's primary display, which is currently unused).

B. Using an existing eDP | HDMI | DVI | etc. output as a virtual one:

i. Declare Variables:

# REPLACE THESE VARIABLES WITH YOUR OWN VALUES:
v_name=eDP                # Unused output that you want to use for Deskreen
v_width=1920              # Put the max for your display (eg. 1920)
v_height=1080             # Put the max for your display (eg. 1080)
v_position=right-of       # Options: right-of | left-of | above | below 
current_output=HDMI-A-0   # Referemce display to use for positioning

ii. Enable the display output, and show info

xrandr --output $v_name --mode "$v_width"x$v_height --$v_position $current_output 

echo -e "\nEXECUTING: \n" 
echo -e xrandr --output "$v_name" --mode "$v_width"x"$v_height" --"$v_position" "$current_output"
echo "\n"; xrandr
 
# My variables looked like:
# xrandr --output eDP --mode 1366x768 --right-of HDMI-A-0

Here is my output after enabling virtual output for `eDP`
EXECUTING: xrandr --output eDP --mode 1366x768 --right-of HDMI-A-0 

Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 16384 x 16384
eDP connected 1366x768+1920+0 (normal left inverted right x axis y axis) 344mm x 193mm
  1366x768      60.00*+  47.99  
  1280x720      60.00  
  1024x768      60.00  
  800x600       60.00  
  640x480       60.00  
  1920x1080     60.00  
HDMI-A-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 575mm x 323mm
  1920x1080     60.00*+  60.00    50.00    59.94    24.00    23.98  
  1680x1050     59.88  
  1280x1024     60.02  
  1440x900      60.00  
  1280x960      60.00  
  1360x768      60.02  
  1280x800      59.91  
  1280x720      60.00    50.00    59.94  
  1024x768      60.00  
  800x600       60.32    56.25  
  720x576       50.00  
  720x480       60.00    59.94  
  640x480       60.00    59.94  
  720x400       70.08 

C. Verify if the new output is detected in Display Settings

Screenshot of Display Settings

2. Easy Part!

Now that all the technical jargon is over, we can finally head to the easy part!

A. Get your Deskreen working

Go ahead and download Deskreen client as a deb or AppImage file (depending on your system), from their official website.

B. Connect your secondary device

Screenshot of Deskreen

I am using my Android Phone as a secondary device here, but feel free to use any reasonable device with a recent enough browser (Firefox, Chrome, Safari)

After opening Deskreen,

  • If you are using a mobile phone, scan the QR code shown there, which will open a link in the browser
  • Or, you can simply enter the URL shown below the QR Code in the browser of another device.
  • But remember, the link changes when the remote device is disconnected, and you will have to allow the device everytime.

    Screenshot of Deskreen Authentication

  • Deskreen will then ask you if you want to allow the device while trying to connect.
  • Screenshot of Deskreen Sharing Choice

  • From there, choose between sharing an entire screen, or just a specific window.
  • Screenshot of Deskreen Screens

  • I am going to share the virtual screen that I just created above!
  • Screenshot of Deskreen Confirm

  • Confirm the choices, or change something if you need to.
  • Screenshot of Phone Browser

  • And, Voila! I have my phone as a secondary display for my laptop, which works wirelessly! :D
  • You can set the quality to auto or anywhere from 25-100%, as well as flip the screen from the ⚙️ icon.

    But hey, don't close the main Deskreen app, keep it minimized, as it doesn't run in the background and will terminate your running remote displays :)

Thank you for reading this far 😉, and feel free to leave a comment for suggestions, queries or issues you are facing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment