2

Solution anyone for a newb? I connect my notebook to external monitor with HDMI. I switch off screen notebook since I'm not using it. Ubuntu 15.04 remembered this setting after reboot, but with 15.10 I have to change this setting every time. Does anyone know how to fix this?

Jacob Vlijm
  • 85,475

1 Answers1

0

The issue is pretty sure the result of a bug, but easily fixed on log in.

What to do

  1. Copy the script below into an empty file, save it as set_screen.py

    #!/usr/bin/env python3
    import subprocess
    import time
    
    #--- set the name of your internal screen below
    internal = "DVI-I-1"
    #---
    
    time.sleep(10)
    
    extr = [l.split()[0] for l in subprocess.check_output("xrandr").decode("utf-8").splitlines() if " connected" in l\
           and not internal in l]
    if extr:
        subprocess.Popen(["xrandr", "--output", internal, "--off", "--output", extr[0], "--auto"])
    
  2. Get your internal screen's name: open a terminal window: press Ctrl+Alt+T, and type the command

    xrandr
    

    and press Enter. Among the lines in the output, there is one line looking like:

    DVI-I-1 connected 1680x1050+0+0 (normal left inverted right x axis y
    

    You need to look at the first string, like DVI-I-1, this is your internal screen's name (obviously, you do not pick the one with HDMI in it :) )

  3. Enter the name you found in the head of the script, in the line:

    internal = "DVI-I-1"
    

    between quotes, like in the example.

  4. Test- run the script with the command (again, from the terminal window):

    python3 /path/to/set_screen.py
    

    (where you obviously need to replace /path/to by the actual path) After ten seconds, the internal screen should shut down, while the external screen stays.

  5. If all works fine, add it to Startup Applications: open Dash > Startup Applications > Add. Add the command:

    python3 /path/to/set_screen.py
    

From now on, within a few seconds after log in, your internal screen will shut down.

Jacob Vlijm
  • 85,475