Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I often need to move my laptop from one working place to another. When I do this, there are two events Ubuntu responds to by changing the monitor set up:

  • Removing/attaching the VGA cable
  • Closing/opening the lid of the laptop

While removing the VGA cable gives me what I need (single screen, highest native resolution on the external screen if connected; otherwise highest resolution on the laptop), the laptop close/open lid response is not as good.

Every time I close or open the lid, Ubuntu reconfigures the monitor set up. When I close the lid now... the screen goes black for a few seconds and it switches to clone, with my laptop screen disabled. Reopening results in... briefly a black screen, then the external monitor being used as desktop extension.

Update: Things changed a bit recently, the behaviour is more predictable now. Closing the lid switches to single display, opening to dual screen (not clone). My question is still accurate: see below.

Ubuntu thinks too much. My first and foremost question: Is there any way to let Ubuntu ignore lid close events?

Ideally (or when there's no way to solve above question) I'd want to change how it deals with the screen reconfiguration. Why does Ubuntu toggle the screen configuration between external, clone and single display? Can't I just configure it to always use the external monitor, when present, in single screen mode?

Note that similar questions have been asked before (most notably this one), but these have been closed perhaps wrongly.

Any ideas are very welcome, I don't mind playing around a bit to see if something works.

share|improve this question
    
For those still interested, questions appear from other people with similar issues: askubuntu.com/questions/161649/… –  Tomas Jul 10 '12 at 1:58
    
I noticed this question is still getting a couple of views per week. I've switched to Arch Linux a while ago and noticed that lid close events are completely ignored by default, not even a screen flicker is seen. It might be that a newer Linux kernel fixes the issues described in this question (both desktop environments I use completely ignore the lid if I tell them to). If so, it is very likely that newer releases of Ubuntu include/will include this fix. –  Tomas Jul 8 at 3:49
add comment

2 Answers 2

up vote 5 down vote accepted
+50

Is there any way to let Ubuntu ignore lid close events?

Lid events are triggered by the lidbtn file in /etc/acpi/events/, which contains two active lines:

event=button[ /]lid
action=/etc/acpi/lid.sh -- comment this out with a # at the beginning

You can ignore lid open/close events by commenting out the second line with a # and then rebooting.

I'd want to change how it deals with the screen reconfiguration.

You can look at and try to modify the file /etc/acpi/lid.sh and the functions/commands it references.

BUT (BIG CAVEAT): If your laptop BIOS uses the lid close/open to switch the internal/external video out ports on/off, then this is beyond the OS ACPI event handler's powers.

share|improve this answer
    
Looks interesting but commenting out the 2nd line does not solve my problem. Diving into the lid.sh file suggests it handles switching off the screen (commands like xscreensaver-command -unthrottle, xscreensaver-command -deactivate, /usr/share/acpi-support/screenblank and xset dpms force on). Nothing is mentioned about switching or detecting screens (I was expecting xrandr or something for this). Any more tips? –  Tomas Jun 2 '12 at 12:16
    
Temporarily move lidbtn from /etc/acpi/events to someplace else, say ~/ . Does that help? –  izx Jun 10 '12 at 1:21
    
Doesn't change anything, as far as I can tell this has the exact same effect as leaving the file there. Have tried rebooting to make sure the change is applied, of course. –  Tomas Jun 12 '12 at 1:52
    
@Tomas: see edit at bottom of the answer. –  izx Jun 12 '12 at 11:55
    
good point. I'll see if I can find anything in my BIOS and will update this edit if I run into anything. Thanks a lot for all the time you put into this :) –  Tomas Jun 13 '12 at 5:05
show 3 more comments

Maybe this solution is too trivial, but it might be useful though. Have you tried to change the options in the Power set up menu? There is an event triggered when the lid is closed on battery or plugged in. Typically this is suspend for laptops, but you can also choose to 'do nothing'.

let me know if that does the trick.

share|improve this answer
1  
Thanks for your answer, but this is not the issue. The option is already set to "do nothing". Suspend works perfectly well, resumes even with the correct resolution. This is why I think the other questions were wrongly closed. –  Tomas Jun 12 '12 at 1:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.