Laptop External Display Troubleshooting

From FreekiWiki
Jump to navigation Jump to search

Nvidia chips may need the updates package installed for the Nvidia driver. Install the nividia-XXX-updates package. This may fix many issues with multi-monitors.


When you are testing the DisplayPort/HDMI on a laptop, and the Display option in Settings Manager is not allowing you to select the external monitor, try the following:

After plugging the laptop into the external monitor, open terminal and enter xrandr. This will give a display like this:

 Screen 0: minimum 320 x 200, current 1280 x 800, maximum 8192 x 8192
 LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 304mm x 190mm
    1280x800       60.0*+
    1024x768       60.0
    800x600        60.3     56.2
    640x480        59.9
 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)
 HDMI2 disconnected (normal left inverted right x axis y axis)
 DP2 disconnected (normal left inverted right x axis y axis)
 DP3 disconnected (normal left inverted right x axis y axis)

Depending on your system, LVDS will be either 0 or 1, and DisplayPort (DP) and HDMI could also be 0 or 1. If your system has multiple DisplayPort or HDMI options, the computer will note which one has the external monitor plugged in; that's the number you want. After than, copy/paste the following code into terminal:

#!/bin/bash
monitor_choice=$(zenity --list --radiolist --column ' ' --column 'Monitor Setting' True "Main Monitor Left" \
False "Main Monitor Right" \
False "Second Monitor Off")
echo $monitor_choice
if [[ $monitor_choice =~ "Left" ]]; then
  xrandr --output DP-0 --auto --left-of LVDS-0 --rotate normal
  xrandr --output DP-0 --auto --left-of LVDS-0 --rotate normal
elif [[ $monitor_choice =~ "Right" ]]; then
  xrandr --output DP-0 --auto --right-of LVDS-0 --rotate normal
  xrandr --output DP-0 --auto --right-of LVDS-0 --rotate normal
elif [[ $monitor_choice =~ "Off" ]]; then 
  xrandr --output DP-0 --off 
  xrandr --output DP-0 --off
fi

If you have an HDMI port, change DP to HDMI. Change the numbers next to DP and LVDS to the ones used with your system. Hit enter, and an option will pop up, select the left monitor. Hit enter again. The external screen should now show the laptop screen.


This the following script should auto-detect your connected monitors and set up the external display:

#!/bin/bash
#
# This script takes the arguments 'left' 'right' and 'off'
# to enable and disable the secondary monitor. 
#
# Run from the commandine like so:
#   ./testmonitor right
#

echo -e "Connected Outputs:"
LVDS=$(xrandr |grep " connected " | sed 's/ connected.*//g' |grep LVDS)
if $LVDS != "" ; then
	echo $LVDS
fi
VGA=$(xrandr |grep " connected " | sed 's/ connected.*//g' |grep VGA)
if $VGA != "" ; then
	echo $VGA
fi
DISPLAYPORT=$(xrandr |grep " connected " | sed 's/ connected.*//g' |grep DP)
if $DISPLAYPORT != "" ; then
	echo $DISPLAYPORT
fi
HDMI=$(xrandr |grep " connected " | sed 's/ connected.*//g' |grep HDMI)
if $HDMI != "" ; then
	echo $HDMI
fi

function addMonitor {
	if $VGA ; then
		xrandr --output $VGA --auto --$1-of $LVDS --rotate normal
	elif $DISPLAYPORT ; then
		xrandr --output $DISPLAYPORT --auto --$1-of $LVDS --rotate normal
	elif $HDMI ; then
		xrandr --output $HDMI --auto --$1-of $LVDS --rotate normal
	fi
}

function disable {
	if $VGA ; then
		xrandr --output $VGA --off
	elif $DISPLAYPORT ; then
		xrandr --output $DISPLAYPORT --off
	elif $HDMI ; then
		xrandr --output $HDMI --off
	fi
} 

echo
echo "Configuring Monitor..."
if $1 == "right" ; then
	addMonitor right
elif $1 == "left" ;then
	addMonitor left
elif $1 == off ; then
	disable
fi

echo "All Done!"

Execute this script like this:

./testMonitor.sh right

Also valid arguments are 'left' and 'off'.