Wednesday, May 25, 2011

Fedora 15, Gnome 3 and closing your laptop's lid...

I upgraded my system today from Fedora 14 to 15 using the preupgrade tool. Everything went VERY smoothly. My nVidia card (Quadro FX 880M) is completely supported with full hardware acceleration, which is awesome!

But the first thing I noticed once I booted into Gnome 3 was that, when I closed my laptop lid, the system went into suspend mode. Not what I want to have happen: unless I'm on battery, I want the system to just blank the screen when I close the lid.

I went into power settings and could not find a setting for what to do when the lid is closed. Something that was very easy to find in past, but now is not obvious.

So a quick google search turned up this solution:

To set the action when the laptop lid is closed, simply enter the following commandline:

gsettings set org.gnome.settings-daemon.plugins.power lid-close-MODE-action “ACTION

where you replace MODE with either ac or battery depending on which mode you're setting, and replace ACTION with blank, suspend, hibernate or shutdown.

17 comments:

  1. I guess it doesn't work for see the following output:
    [root@localhost john]# gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action “blank”
    0:expected value

    ReplyDelete
    Replies
    1. try to put the action without quotes as in:
      gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action blank
      gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action suspend

      Delete
  2. Strange. I just enter the same command on my system and it worked fine:

    (mcpierce@mcpierce-laptop:~)$ gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action "blank"
    (mcpierce@mcpierce-laptop:~)$

    I see you entered it as root. Does root have a Gnome desktop setting?

    ReplyDelete
  3. Thank you very helpful!!!

    Don't enter as root or sudo will not work.

    ReplyDelete
  4. Actually if you download the Gnome Tweak Tool and click on the shell tab it has the settings for closing the laptop lid.

    ReplyDelete
  5. Thanks a ton Larry. Remembering names of apps such as that is much better than trying to remember commands on top of everything else you have to know.

    ReplyDelete
  6. Thanks, I had remembered reading about the fact that GNOME devs decided to remove this setting, and then forgot about it. Installed Fedora last night, started installing a bunch of stuff, closed the lid (not all the way even) to go to sleep without the light disturbing, woke up this morning, and opened my laptop to discover the download hadn't progressed since I closed the lid and that wifi had turned off. This is exactly the behaviour I hated on my old iBook, where you would have to wait for the damn thing to actually shut down before closing the lid, or it would suspend/hibernate (I'm just not a fan).

    ReplyDelete
  7. Funny, I would like the default setting but it doesn't work for me. :) Close-when-on-battery works, close-when-on-AC works, close-when-on-dock doesn't...

    ReplyDelete
  8. thanks you for writing this blog entry. it worked perfect on my fedora 15 x86_64 installation.

    ReplyDelete
  9. I just got used to suspend on lid close. Worked on F16.

    ReplyDelete
  10. Nice, worked. For those who are getting "expected value", "value out of range", etc, try to put the action without quotes as in:
    gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action blank
    gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action suspend

    ReplyDelete
  11. None of these work in Fedora 16. I've used gnome-tweak-tool and did the command line (both with and without the quotes). On ac power, shutting the lid suspends. when I reopen the lid, it is totally horked and I need to reboot.

    ReplyDelete
    Replies
    1. Can you post the specific command line you tried? Also, what sort of laptop and which kernel version are you using?

      Delete
    2. Hey Nathan,

      I had the same problem on Fedora 18. The problem was with systemd APCI overriding the gnome settings. The fix was to edit the line in /etc/systemd/logind.conf containing "HandleLidSwitch" to:

      HandleLidSwitch=ignore

      and restart the service:
      systemctl restart systemd-logind.service

      Hope this helps.

      Delete