≡ Menu

How to Set an External Monitor as the Primary and Only Screen When Connected to a Laptop Computer on Linux

In my home office, I have a dual monitor setup—the laptop computer is held on a notebook tray, which in turn is on an Ergotron LX Desk Mount Arm. The external monitor is on the left side of the laptop computer, and is held by another Desk Mount Arm. Both arms share the same desk mounting pole.

Home Office Setup

My home office setup.

I have previously described how I automated the xrandr configuration on login.

A few days ago, my Samsung SyncMaster 943NWX 19″ external monitor was behaving erratically, with intermittent periods of turning all black and then returning to normal while being connected to my Lenovo T61 laptop computer. I thought it might have had something to do with the VGA connection between the computer and the monitor, so I turned off the computer and checked that there weren’t any loose connections. When I turned the computer back on, everything seemed to work normally for a few minutes, and then the monitor of the laptop computer went black. I rebooted the machine a few more times, and the same thing happened.

Having been spoilt by a dual-monitor setup for years, the loss of screen real estate was frustrating. To make matters worse, although the laptop monitor was all-black, elements of the graphical user interface were still “there,” in that the operating system still behaved as if the space was usable. For example, when I tried to open folders and files, they sometimes opened in the “dead” space, and I therefore would not be able to see them and wonder whether there was something wrong with the system.

There are only three things that can cause this problem:

  1. LCD failure
  2. Problematic backlight Cold Cathode Fluorescent Lamp (CCFL)
  3. Faulty inverter card

1. and 2. are essentially the same thing because the fix is a replacement of the LCD. I tried to salvage a CCFL from an old and nonfunctional T61 that was lying around but ended up accidentally breaking it—that thing is really fragile! I also changed the inverter card from the spare T61, and the problem with the monitor remained unchanged. Therefore, a busted inverter card is not the issue. In short, I need a new LCD. A brand new LCD, including shipping, will set me back about $120. A used but perfectly functional T61 will cost about $170, including shipping. I’d rather purchase a whole T61 because I may use the other parts, e.g. motherboard, in the future. It will also be a much easier to remove the entire LCD assembly than to replace the LCD.

Until the donor T61 turns up, I needed to make the current configuration workable. So I simply turned off the internal monitor and have everything on the external monitor. Things are lot better now compared to the last few days, but of course not as good as with two monitors.

There was only one thing I changed in /etc/X11/Xsession.d/45custom_xrandr-settings, i.e., from

xrandr --output $INTERNAL_OUTPUT --auto


xrandr --output $INTERNAL_OUTPUT --off

This is what the entire code in /etc/X11/Xsession.d/45custom_xrandr-settings looks like now:

# If an external monitor is connected, place it with xrandr
# External output may be "VGA" or "VGA1" or "VGA-0" or "DVI-0" or "TMDS-1"
# EXTERNAL_LOCATION may be one of: left, right, above, or below
               EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
               EXTERNAL_LOCATION="--right-of $INTERNAL_OUTPUT"
               EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
xrandr |grep $EXTERNAL_OUTPUT | grep " connected "
if [ $? -eq 0 ]; then
    xrandr --output $INTERNAL_OUTPUT --off --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION
    # Alternative command in case of trouble:
    # (sleep 2; xrandr --output $INTERNAL_OUTPUT --mode 1280x800 --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION) &
    xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --off

When I replace the LCD assembly in a few weeks’ time, I’ll simply change the xrandr internal output back to “auto”.

{ 0 comments… add one }

Leave a Comment