Not updating display settings when disconnecting external monitor

7,365

Solution 1

There is an old bug on Launchpad - bug #306735 - which was marked invalid, the explanation being that it is a known problem but fairly complex (more explanation here).

So, as far as I know, there is not an automatic method for what you asked in the true sense. But you can use autorandr (you have to install disper first - run sudo apt-get install disper from terminal), a script by Stefan Tomanek. Using this script (autorandr) you can add a keyboard shortcut for autorandr --change command and all you have to do when you connect or disconnect an external monitor is to press that keyboard shortcut. All of these are explained very nice in this answer (I just tested in Ubuntu 13.04 and everything goes well).

After you test the script in terminal, you must to see the following post if you want to add a custom keyboard shortcut for the script:

Solution 2

If you are running some flavour of nvidia's proprietary driver, then, as mentioned in Jorge's answer, just running xrandr on its own seems to fix the issue.

Solution 3

From the Appendix B in the NVIDIA driver README:

Option "UseHotplugEvents" "boolean"

When this option is enabled, the NVIDIA X driver will generate RandR display changed events when displays are plugged into or unplugged from an NVIDIA GPU. Some desktop environments will listen for these events and dynamically reconfigure the desktop when displays are added or removed.

Disabling this option suppresses the generation of these RandR events for non-DisplayPort displays, i.e., ones connected via VGA, DVI, or HDMI. Hotplug events cannot be suppressed for displays connected via DisplayPort.

Note that probing the display configuration (e.g. with xrandr or nvidia-settings) may cause RandR display changed events to be generated, regardless of whether this option is enabled or disabled. Additionally, some VGA ports are incapable of hotplug detection: on such ports, the addition or removal of displays can only be detected by re-probing the display configuration.

Default: on. The driver will generate RandR events when displays are added or removed.

So, assuming you have not disabled this option, the problem narrows to one of these alternatives:

  • The VGA cable or the VGA connector on the card have some DDC pins broken (either pin 12, pin 15 or pin 9). Please attach another VGA cable and try again.

  • Your Nvidia Quadro K1000M based video card has a connector that does NOT support this detection, and invoking xrandr or equivalents (as opening the Display Settings) fire this detection. If that is the case, this will never work --but the detection shouldn't work either on other Operative Systems. Never seen this in person, though.

  • Or maybe there is some bug on the NVIDIA driver that prevents this detection from working properly. Try another driver versions (such as 304) and see if the problem persists.

Share:
7,365

Related videos on Youtube

Joren
Author by

Joren

Updated on September 18, 2022

Comments

  • Joren
    Joren over 1 year

    When I disconnect my monitor from my laptop, Ubuntu still seems to think that it is plugged in and does't update the display. This issue is Ubuntu specific (not occuring in windows) and my monitor worked fine with another laptop (Ubuntu 13.04, exact same drivers).

    The quickfix:

    • open system settings
    • click Displays

    Useful specs:

    • Graphics drivers: nvidia-313 (problem also occurs with the other propriatary drivers)
    • Graphics card: Nvidia Quadro K1000M
    • Monitor: Benq ET-0019-N
    • Cable: VGA D-sub DE15
    • OS: Ubuntu 13.04

    I would like Ubuntu to update the display settings automagically whenever the monitor cable gets disconnected. How would I do that?

    • h3.
      h3. almost 11 years
      What monitor is it? Some older monitors don't send any signal so the computer doesn't know whether it's there, but I don't think there are many left in service. Also what exact model of graphics card do you have, and are you using the proprietary driver or the free driver?
    • Joren
      Joren almost 11 years
      I've edited my question to answer yours.
    • Jorge Suárez de Lis
      Jorge Suárez de Lis over 10 years
      The display settings are updated when you start the computer without the cable, and then attach it? If not, are they updated when you issue the command xrandr manually?
    • Jorge Suárez de Lis
      Jorge Suárez de Lis over 10 years
      Can't you try another monitor and cable? I know that it's working on Windows, byt maybe Windows is using another method for autodetection.
    • Joren
      Joren over 10 years
      I don't have another monitor :(
  • Jorge Suárez de Lis
    Jorge Suárez de Lis over 10 years
    Ok. This isn't a valid answer, but to try to help you: while you wait for an answer, ask also on the NVIDIA Linux forum.
  • Joren
    Joren over 10 years
    Thank you for the suggestion. (devtalk.nvidia.com/default/topic/606465/linux/…)
  • Joren
    Joren over 10 years
    I had disper already installed but autorand wasn't found
  • Radu Rădeanu
    Radu Rădeanu over 10 years
    @Joren What do you mean by was'n found? It is a script at the given link in the answer. Do you need help about how to use or run it?
  • Joren
    Joren over 10 years
    Oh nevermind, I thought it came automagically with disper
  • Radu Rădeanu
    Radu Rădeanu over 10 years
    @Joren No, it doesn't (I thought that my answer was clear). You have to manually create a file script named autorandr or autodisper, put inside all the text from here exactly as it is and save it in your ~/bin directory. Don't forget to make it executable with: chmod +x ~/bin/autorandr (or chmod +x ~/bin/autodisper) and then just run autorandr --help (or autodisper --help) for further help.
  • Nigini
    Nigini over 7 years
    I still had this problem using 16.04! =/ The disper is still around but I had to run something like disper -e and everything got back to work, even the Display application.