Linux X11 screen setup for projectors/beamers

How to present onto a big screen from a linux laptop.

Does not always work: Just duplicate

When presenting I like to see the same screen on my laptop as the audience sees on the big screen behind me. That way I can face the audience.

One can quite easily duplicate the laptop screen to the projector by running these commands:
# detect the projector display:
xrandr --query

# clone the screen:
xrandr --output LVDS-0 --auto --output VGA-0 --auto --same-as LVDS-0
You can run these commands as normal user (no root rights needed). This clones the laptop display (LVDS-0 in my case, check "xrandr --query" too see what it the name on your laptop) to the VGA-0 output where the projector is connected.

How do you read this command? The syntax of xrandr works such that you specify an output and after that output options that say what to do with that output after that the next output ...:
xrandr --output LVDS-0 ...options that say what to do with LVDS-0... --output VGA-0 ...options that say what to do with VGA-0...
There are however a number of problems with this simple setup and it's generally not what you want.

Problem: Multiple screens and openoffice in presenter mode

The problem is that the above very simple configuration works only if the projector supports the same screen resolution as the laptop LCD screen. Here is e.g. a printout from a laptop LCD screen that supports multiple resolutions and it would probably work with this kind of laptop:
xrandr --query

Screen 0: minimum 320 x 200, current 1440 x 900, maximum 8192 x 8192
LVDS1 connected 1440x900+0+0 (normal left inverted right x axis y axis) 287mm x 180mm
   1440x900       60.0*+   50.0
   1152x864       75.0
   1024x768       85.0     75.0     70.1     60.0
   832x624        74.6
   800x600        85.1     72.2     75.0     60.3     56.2
   640x480        85.0     72.8     75.0     59.9
   720x400        85.0
   640x400        85.1
   640x350        85.1
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
Theses days the above example printout seems to be a rare case and there is a good chance that projector and laptop LCD screen have not a single mode in common. The screen resolution on the laptop is normally much higher than any of the supported resolutions of the projector.
xrandr --query

Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
VGA-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 2000mm x 1500mm
   1024x768       60.0 +   85.0     75.0     70.1  
   1400x1050      60.0  
   1360x765       60.0  
   1280x1024      85.0     75.0  
   1280x960       75.0  
   1280x768       59.9  
   1280x720       60.0  
   1152x864       85.0  
   800x600        75.0     72.2     60.3     56.2  
   800x500        85.0  
   640x480        75.0     72.8     59.9  
LVDS-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 345mm x 194mm
   1920x1080      59.9*+
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 disconnected (normal left inverted right x axis y axis)
DP-6 disconnected (normal left inverted right x axis y axis)
You can see that the laptop screen (LVDS-0) supports only one resolution (1920x1080) and the projector (VGA-0) supports multiple screen resolutions but not 1920x1080. What happens is this: The projector will just show the upper left corner of the laptop screen. That's fine if you can resize your application window to that area but if you use openoffice in presenter mode then the audience will only see a portion since Openoffice is in "full screen mode".

A work around would be to position the VGA screen right of the laptop screen but then you see one thing on your laptop and another area on the projector screen:
xrandr --output LVDS-0 --preferred --pos 0x0 --rotate normal --output VGA-0 --mode 1280x1024 --right-of LVDS-0  --primary
The biggest problem with this setup is however that Openoffice in presenter mode (press F5 in openoffice) goes to the left most screen (the laptop screen which is left of the projector screen) and the audience will see nothing. We could position the laptop screen right of the projector screen such that the vga screen is at position 0x0:
xrandr --output LVDS-0 --preferred --rotate normal --output VGA-0 --mode 1280x1024 --left-of LVDS-0 --primary
It would work with Openoffice but it's still a confusing setup for the person doing the presentation.

Solution: Scale your laptop screen to a resolution supported by the projector

The solution is to use the "xrandr --scale" option and resize your laptop screen to the same size as one of the resolutions supported by the projector:
# probe and show screens:
xrandr --query

#scale 1920x1080 to 1280x1024
xrandr --output LVDS-0 --scale 0.6666x0.948 --output VGA-0 --mode 1280x1024 --same-as LVDS-0
Laptop screen and projector screen show now the same. It's the best setup for the openoffice slide presentation mode. If you are worried about calculating the right the scaling factor: It does not have to be exact. The only effect would be that the audience will miss a few screen pixel and it's probably not a problem.

To reset the screen again at the end of the presentation you just run:
xrandr --output LVDS-0 --scale 1.0x1.0
To make your life easier I would suggest to put those commands into a number of scripts. That way you will not need to run complicated commands while you are possibly a bit nervous just before the start of the presentation. It's better if you don't have to troubleshoot with the audience waiting. You can prepare a few scripts or bash aliases for a number of projector resolutions. Here are some scripts:
#!/bin/sh -x
#script xrand_probe.sh
xrandr --query

#!/bin/sh -x
#script xrand_vga1280x1024.sh
xrandr --output LVDS-0 --scale 0.6666x0.948 --output VGA-0 --mode 1280x1024 --same-as LVDS-0

#!/bin/sh -x
#script xrand_vga1024x768.sh
xrandr --output LVDS-0 --scale 0.5333x0.7111 --output VGA-0 --mode 1024x768 --same-as LVDS-0

#!/bin/sh -x
#script xrand_reset_normal.sh
xrandr --output LVDS-0 --scale 1.0x1.0

Help me now: What command do I need to run?

Screen on your Laptop:

The projector:

Result, command to run:

Common names of output ports



© Guido Socher,