Ubuntu – way to autodetect when a display is disconnected


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!

Best Answer

First install disper, then download autorandr and follow these instructions:

  • 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
  • Try:

    auto-disper.sh --change

    with docked and undocked monitor. It should detect the state and change the configuration.

  • Finaly make a keyboard shortcut for auto-disper.sh --change

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!

Related Question