Disabling laptop monitor when external HDMI monitor is plugged in

9

1

I can connect my Ubuntu 12.04 laptop to my television via HDMI, and use the TV as a monitor. Unfortunately, it's a second monitor; I want it to be an only monitor. (I get annoyed moving the mouse from one monitor to the other. I just want everything to be on the TV. I don't want to have to drag things to the right of my laptop screen to see them on my TV screen.) Please advise me on options, including disabling the built-in monitor.

A particularly annoying aspect of my current configuration is that, even after I drag a window to the TV, if I try to put it into full screen mode, it reverts to the laptop display.

Mike Wentworth

Posted 2014-01-14T21:31:35.150

Reputation: 203

clarification: are you asking “How do I disable the built in monitor and enable the external hdmi tv?” ? – ctrl-alt-delor – 2014-01-14T22:03:57.347

Yup, exactly... – Mike Wentworth – 2014-01-14T22:06:49.383

Can't you do this via the Displays application in Unity? I think each display has an on-off toggle? Or you could set it to mirror displays . . . – ernie – 2014-01-14T23:12:14.360

Can you clarify Scott's interpretation. If it is correct would you like to have the two screens, but be able to maximise on your screen of choice. – ctrl-alt-delor – 2014-01-15T09:10:17.250

I installed the kde desktop, because it makes configuration easier. Unity has the policy of if you can not configure much, then it will be easier. If you want to stick with unity, then I suggest moving the question to Ask Ubuntu – ctrl-alt-delor – 2014-01-15T09:12:55.620

@richard The question is on topic here, so it does not need to be moved somewhere else. Please read this Meta post or this blog post. If the OP wants it migrated if it doesn't get an answer, they can flag it.

– slhck – 2014-01-15T09:42:33.217

Answers

11

Using xrandr

  • Open a terminal window.
  • type xrandr. It will list all video ports. 2 will have some data below them 1920x1200 etc. One is tv the other is laptop monitor.
  • Assuming the laptop monitor is called LVDS1 then type xrandr --output LVDS1 --off

There is also a graphical tool to do it, but I know not of how to do this using the ubuntu unity desktop. (If you are running kde, gnome or other then do tell.)

ctrl-alt-delor

Posted 2014-01-14T21:31:35.150

Reputation: 1 886

2Which config file to add this command line to in order to apply this change on every startup, ideally right from the login screen? – fviktor – 2015-07-22T05:59:54.937

Does anyone know if it it possible to automate this when the laptop sees the new HDMI monitor? – Neil Wightman – 2018-07-10T08:03:07.813

@NeilWightman I would assume so. The OS knows that the HDMI is plugged in, so can trigger an event, to run a script. However I have never done it. – ctrl-alt-delor – 2018-07-10T12:09:38.383

@NeilWightman A Startup Application at login can check for hdmi before turning off the laptop screen with "xrandr | grep -q 'HDMI-0 connected primary' && xrandr --output LVDS-0 --off" – yoyoma2 – 2019-02-27T14:33:52.923