5

I have a laptop that is hooked up to a monitor via a VGA cable. I'm trying to get the display set to the external monitor only (I don't want any display on the laptop screen). However, whenever I set the laptop display to "off" in the "Displays" setting, their isn't a display on either (the laptop screen and the monitor have no signal). So, how do I get it to where the display only shows up on the external monitor?

3

You can use xrandr to change the default primary monitor.

Turns out xrandr --output DFP1 --primary does the trick. Replace DFP1 to the name of the monitor you want to make your primary monitor. You can run xrandr --prop to get the proper names of the monitors currently connected.

If you run xrandr --output DFP1 --primary, it does switch the primary monitors, but once you restart your laptop, the laptop becomes the primary display once again.

So, I thought I would write a simple script, that runs at start up, which checks, if there is an external monitor connected, and if there is, then run the command to make the external monitor the primary display.

#!/bin/bash
NR_OF_MONITORS=$(xrandr -d :0 -q | grep ' connected' | wc -l)
if [ $NR_OF_MONITORS = "2" ]; then
  xrandr --output DFP1 --primary
fi

Source

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.