Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Am running 12.04 and Gnome Shell with a Thinkpad X201 laptop and docking station. When I start the Thinkpad in the docking station with the lid closed, Ubuntu is recognizes that the external monitor is primary (DP1), but defaults the laptop LCD (LVDS1) as on. I would like it to be off at startup when in this mode.

I discovered this answer and developed a version of the script indicated:

XRANDRexternal="xrandr --output HDMI1 --off --output LVDS1 --off --output DP1 --mode 2560x1600 --pos 0x0 --rotate normal --output VGA1 --off"
XRANDRnoexternal="xrandr --output HDMI1 --off --output LVDS1 --mode 1280x800 --pos 0x0 --rotate normal --output DP1 --off --output VGA1 --off"
if xrandr | grep -q ' connected'
then
${XRANDRexternal}
else
${XRANDRnoexternal}
fi

I then tried to place this in my lightdm.conf as suggested in the post:

[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
display-setup-script=/usr/share/display-setup-script.sh

I verified that the script worked by running it first in terminal. At this point I can't automate this at startup. I tried both the display-setup-script and session-setup option and neither work. I also tried sticking this into my startup applications to no avail.

I'm not sure how to troubleshoot this further.

share|improve this question
add comment

1 Answer 1

After hacking away at it, I finally got it to work.. I was never able to get this to execute from LightDM but adding the sleep option and adding it to startup applications worked

#!/bin/bash
sleep 5
XRANDRexternal="xrandr --output HDMI1 --off --output LVDS1 --off --output DP1 --mode 2560x1600 --pos 0x0 --rotate normal --output VGA1 --off"
XRANDRnoexternal="xrandr --output HDMI1 --off --output LVDS1 --mode 1280x800 --pos 0x0 --rotate normal --output DP1 --off --output VGA1 --off"
if xrandr | grep -q ' connected'
then
${XRANDRexternal}
else
${XRANDRnoexternal}
fi
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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