Monday, May 27, 2013

Solved: The "Preventing laptop from suspending on lid close Gnome" headache

    Locking your screen on closing the lid is no longer an option in Gnome. Don't you hate it? I for one have to close the lid often and I hate it when the laptop is suspended. I had to go over a lot of places for getting a solution and finally got one after lots of IRC discussions, a bug report (which I marked invalid myself ;) ) and obviously googling.

TL; DR version:
There are 2 possible solutions:
1. Changing "HandleLidSwitch=lock" in /etc/systemd/logind.conf (didn't work for me...)
2. Run this on a terminal: systemd-inhibit --what=handle-power-key:handle-suspend-key:handle-lid-switch sleep 999999. Don't put in bashrc file, I am not able to log back in my OpenSuSE 12.3 installation!!

Now, the longer version:
    The problem started when the gnome devs got frustrated with the system inhibitors preventing their laptops from suspending. In the comments, you could literally see the devs crying about this problem and fearing that their laptop batteries would soon die.
Solution: Gnome has default removed the lid switch handle and even if it is present, it ignores it by default.    This means, no matter what setting you have, the laptop would suspend on lid close. The points made by the devs will make you agree with their solution.
    I was not aware of all this discussion and hence thought the problem was with Gnome-Tweak-Tool which gives you an option to set the action on laptop lid close. Hence, reported a bug. Later on, after some Google search for alternatives I realized that the problem was not with the tool but with Gnome, but didn't know what.
    I discussed the issue at #suse irc channel but turns out they are mostly KDE users. On trying a gsettings solutions, I found an error saying that the power schema itself was missing! Then I went to the Gnome channel and luckily Florian Müllner was online the third time I posted the question. He told me that the problem was not about the power schema but about system-inhibitors and gave me a heads up for the solution. He is a really patient guy!! A little bit of Googling brought me to the above mentioned 2 solutions.
    Unfortunately the first one doesn't work for me but works for others. The second one worked for me though. The solution may have worked but I didn't want to enter the command everytime and hence I put it in my bashrc file as I never want my laptop to suspend on lid close. Turns out, I am unable to login to my OpenSuSE installation ever since I modified the bashrc file!! Will have to modify the file now :(
    I must say the Gnome experience since Gnome 3 has not been that good.


1 comment:

  1. Hello stupid Indian asshole,

    piss off, you are nothing than a useless piece of stinking Indian IT shit. Piss off, and never come back. Nobody wants assholes like you on Stackoverflow. Go herding cows, idiot.