I am running Ubuntu on a Dell Latitude with the latest Nvidia drivers. Basically what I want is when I disconnect my external display that everything goes back to the main one without having to change the config every time.
Any help is welcome!
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
When the external monitor is undocked, run the following command in terminal:
auto-disper.sh --save undocked
When the external monitor is docked and configured as you want (with Nvidia X Server Settings), run:
auto-disper.sh --save docked
with docked and undocked monitor. It should detect the state and change the configuration.
I tried to make a script that run it every 3 seconds, so auto-dectection works, but use too much ressource. Hope that can help!
I'm in about the same situation. I use a laptop which is sometimes connected to my external monitor. When it is, I usually want to use only this monitor (because I have it hooked up to an external keyboard & mouse also).
What you should do is save it to ~/.xprofile and then make it runnable (chmod +x .xprofile). Check how your internal and your external monitors are called - do this by running xrandr with no arguments. Mine are VGA1 and LVDS1 respectively. The last thing is to set the EXTERNAL_RES variable to the native resolution of your external monitor.
Now on boot up, the connected monitor will be used if it is connected. The tricky part is automation (such as removing the cable while Ubuntu is running). I haven't found a very good solution for this, but it seems that switching to a virtual console and back does the trick (Ctrl-Alt-F1 and then Ctrl-Alt-F7). It's a bit quicker than cycling through all the possibilities with the Fn key (which also sometimes messes up the display).
Use disper. After installing it, you may want to create two shortcuts:
disper "max" -S
disper "max" -s
Automatic detection would be cool. Meanwhile I found this blog post which shows how to bind a key to a provided script that toggles between displays. It works pretty well for me. It would be nice if Ubuntu provided something like this out of the box.