Bug 687277 - [REGRESSION] gnome-settings-daemon blanks the screen when lid is closed
: [REGRESSION] gnome-settings-daemon blanks the screen when lid is closed
Product: gnome-settings-daemon
Component: power
Version: unspecified
Status: RESOLVED
Resolution: OBSOLETE
Priority: Normal
Severity: normal
Description William Ting [reporter] 2012-10-31 16:15:28 UTC
I upgraded to GNOME 3.6 on ArchLinux x86_64 last night.

Now when I close the laptop lid, it unconditionally suspends in gnome-shell and
fallback mode. In gnome-tweak-tool, both "Laptop lid close action on battery"
and "Laptop lid close action when on AC" are both set to "Blank".

Related: bug 638865 (https://bugzilla.gnome.org/show_bug.cgi?id=638865)
Comment 1 William Ting [reporter] 2012-10-31 18:11:11 UTC
Adding this line to `/etc/systemd/logind.conf` will prevent the behavior:

    HandleLidSwitch=ignore

However now when I go into gnome-tweak-tool and change lid behavior on battery
and AC from "blank" to "suspend", it doesn't do actually suspend when I close
the lid.
Comment 2 William Ting [reporter] 2012-11-01 01:55:32 UTC
More data:

╭─ting@noa ~ ‹python-2.7.3› ‹ruby-1.9.3› 
╰─➤  systemd-inhibit --list                                                    
                                                  127 ↵ 2012.10.31 20:50:40 CDT 
WHAT                                                     WHO                 
WHY                  MODE     UID    PID
handle-power-key:handle-suspend-key:handle-hibernate-key ting                
GNOME handlin...sses block   1000    776
sleep                                                    root                
inhibited            delay      0    309
handle-lid-switch                                        ting                
Multiple disp...ched block   1000    776

3 inhibitors listed.

╭─ting@noa ~ ‹python-2.7.3› ‹ruby-1.9.3› 
╰─➤  gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action 
                                                        2012.10.31 20:50:49 CDT 
'suspend'
╭─ting@noa ~ ‹python-2.7.3› ‹ruby-1.9.3› 
╰─➤  gsettings get org.gnome.settings-daemon.plugins.power
lid-close-battery-action                                                    
2012.10.31 20:53:33 CDT 
'suspend'
Comment 3 Matthias Clasen [developer] 2012-11-01 03:18:55 UTC
The lid-close-{ac,battery}-action keys have been removed.
We really want lid close to be the way to suspend.
If you can't tolerate that, you can use systemd-inhibit to put an inhibitor in
place that will keep it from happening.
Comment 4 William Ting [reporter] 2012-11-01 03:59:37 UTC
Hi Matthias,

I have modified systemd to get the behavior I want. As per bug 638865, there
are many reasons why *always* suspending when closing lid is poor design. I
don't see why GNOME should follow suit and copy OS X behavior. Even in OS X's
case, they disable sleep when an external input device / monitor is plugged in.

If you choose to disregard users' complaints, now the problem is why do we have
these two ineffective settings in gnome-tweak-tool? Either they need to be
removed or fixed. Displaying broken switches leads to poor user experience.
Comment 5 Samuel Sieb 2012-11-01 08:07:25 UTC
I just ran into this too.  One of the first things I do when I install a laptop
is use gnome-tweak-tool to disable suspending on lid close.  I second the last
comment.  If you aren't going to fix it, then better remove those options from
gnome-tweak-tool...
Comment 6 Matthias Clasen [developer] 2012-11-01 13:21:52 UTC
(In reply to comment #4)
> Hi Matthias,
> 
> I have modified systemd to get the behavior I want. As per bug 638865, there
> are many reasons why *always* suspending when closing lid is poor design. I
> don't see why GNOME should follow suit and copy OS X behavior. Even in OS X's
> case, they disable sleep when an external input device / monitor is plugged in.

We do that too, by default.
You can override this with the

org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor

setting.

> If you choose to disregard users' complaints, now the problem is why do we have
> these two ineffective settings in gnome-tweak-tool? Either they need to be
> removed or fixed. Displaying broken switches leads to poor user experience.

The settings are gone now.
Comment 7 Michel Alexandre Salim 2012-11-01 17:53:26 UTC
(In reply to comment #6)
> (In reply to comment #4)

> > If you choose to disregard users' complaints, now the problem is why do we have
> > these two ineffective settings in gnome-tweak-tool? Either they need to be
> > removed or fixed. Displaying broken switches leads to poor user experience.
> 
> The settings are gone now.

To clarify - presumably the settings are gone in gnome-settings-daemon trunk?
They're still there in 3.6.1, and gnome-tweak-tool actually hasn't been
updated. I'll patch it tomorrow and send it upstream.
Comment 8 Samuel Sieb 2012-11-01 21:06:06 UTC
Is there a discussion somewhere of what trouble those options were causing? 
Would it possible to just have one checkbox to disable suspend on lid close,
like the one for having an external monitor?  That's all I care about.
Comment 9 Matthias Clasen [developer] 2012-11-01 22:21:41 UTC
They're removed in master, with this commit:

http://git.gnome.org/browse/gnome-settings-daemon/commit/?id=58cb4eee64bbd8ca43111b1f80fdaacde8ad5f12

Can't remove them in 3.6, since the move to let systemd handle lid close has
only happened in master. We should perhaps put that patch into the f18 package
though, since that has the systemd patch and ignores the settings.
Comment 10 Michel Alexandre Salim 2012-11-02 04:20:05 UTC
Ah, so this only affects Fedora 18, and somehow Arch Linux, but distributions
that use stock GNOME 3.6.x would not be affected?

In that case, the g-t-t fix should probably only go into master as well (I
don't think there's a 3.6 branch right now, but it should be created in this
case) and only cherry-picked for distros that carry the systemd patch.
Comment 11 Michel Alexandre Salim 2012-11-02 07:13:53 UTC
Reported, with a patch, against gnome-tweak-tool:
https://bugzilla.gnome.org/show_bug.cgi?id=687413
Comment 12 Juan Antonio 2012-11-04 13:19:10 UTC
I really can't understand why remove this option if it is already implemented
and it disturb nobody but it is pretty useful for a lot of people like me.
Comment 13 Juan Antonio 2012-11-07 08:03:11 UTC
(In reply to comment #6)
> (In reply to comment #4)
> > Hi Matthias,
> > 
> > I have modified systemd to get the behavior I want. As per bug 638865, there
> > are many reasons why *always* suspending when closing lid is poor design. I
> > don't see why GNOME should follow suit and copy OS X behavior. Even in OS X's
> > case, they disable sleep when an external input device / monitor is plugged in.
> 
> We do that too, by default.
> You can override this with the
> 
> org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor
> 
> setting.
> 
> > If you choose to disregard users' complaints, now the problem is why do we have
> > these two ineffective settings in gnome-tweak-tool? Either they need to be
> > removed or fixed. Displaying broken switches leads to poor user experience.
> 
> The settings are gone now.


Closing the laptop lid when an external vga monitor is connected doesn't
suspend the system but the monitor shutdown himself.
Comment 14 Matthias Clasen [developer] 2012-11-07 23:51:31 UTC
In case I hadn't mentioned this here yet: the command to override the default
lid switch handling on a systemd system is:

systemd-inhibit --what=handle-lid-switch \
                --who=me \
                --why=because \
                --mode=block /bin/sh
Comment 15 Mattias Bengtsson 2012-11-22 01:14:33 UTC
(In reply to comment #13)
> Closing the laptop lid when an external vga monitor is connected doesn't
> suspend the system but the monitor shutdown himself.

This happens to me too on unreleased F18. The intended behaviour is to not
suspend on lid close if we are attached to an external monitor (+ input
devices) right?
Comment 16 William Ting [reporter] 2012-11-22 01:18:36 UTC
@Mattias Bengtsson: Intended behavior is to suspend in all circumstances,
regardless of input devices or external monitors.
Comment 17 Matthias Clasen [developer] 2012-11-22 02:45:31 UTC
The behaviour depends on the 
org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor
setting. gnome-tweak-tool has UI for this.
Comment 18 Mattias Bengtsson 2012-11-22 02:58:53 UTC
 $ dconf read
/org/gnome/settings-daemon/plugins/power/lid-close-suspend-with-external-monitor 
false

This is what's in dconf for me. Which I believe(?) also is the default.
However, the attached screen still shuts down on laptop lid close. It probably
doesn't suspend though, like Juan said above, so should this go in a separate
bug instead?.
Comment 19 David 2012-12-05 23:26:54 UTC
Suffering from the same issue. Suspend doesn't care about a monitor connected
even if
/org/gnome/settings-daemon/plugins/power/lid-close-suspend-with-external-monitor
== false and just suspends.
Had to set HandleLidSwitch=ignore in /etc/systemd/logind.conf
Now the laptop only suspends if I tell it to by pressing the menu button...
wich I GUESS is not the desired way it should work... right?!

Am on Archlinux, Gnome 3.6.4, latest Kernel (3.6.9)
Comment 20 Orest Tarasiuk 2012-12-25 22:03:45 UTC
While suspending by default when the lid is closed is perfectly fine, removing
this option (option!) from Gnome Tweak Tool -- which is obviously an external
and advanced utility -- is definitely a bad idea. "Normal users" won't be
installing it anyway and advanced users will be trying to use it anyway to
change this behaviour. Not letting them do so will cause irritation without
contributing any good.

Additionally, this makes creating extensions that give you more control over
what the lid triggers (e. g.
https://extensions.gnome.org/extension/417/blank-on-lid/ ) very difficult and
platform-dependent (because now it's systemd, acpid or the like that handle
suspending).

Moreover, by not taking any action and not inhibiting daemons (instead of
forcing a suspend), Gnome Shell doesn't even ensure that the PC will suspend in
the first place! (If there is no systemd/acpid/..., the PC just won't react,
the screen won't even get locked!).

Any comments on these points?
Comment 21 Samuel Sieb 2013-01-12 01:53:31 UTC
If you read the other bug, the option was removed from the tweak tool because
support for that option was removed from Gnome.  And the screen will get locked
as normal after the idle timeout is reached.

(And don't shoot the messenger. :-)  I disagree with both of these decisions,
I'm just explaining the current situation.)
Comment 22 Matthias Clasen [developer] 2013-01-12 14:26:11 UTC
gnome-power-manager is not involved in this anymore
Comment 23 Orest Tarasiuk 2013-01-14 00:55:59 UTC
Okay, thank you. Do you know whom I should contact (or which bug to consult) to
try to convince them in order to have this functionality restored to Gnome?
Comment 24 Samuel Sieb 2013-01-14 01:04:53 UTC
This is the right place and they've been pretty clear that they won't
reconsider it.  See Bug 638865 for more details and discussion.
Comment 25 Bastien Nocera [gnome-settings-daemon developer] 2013-01-23 21:23:47 UTC
(In reply to comment #13)
> Closing the laptop lid when an external vga monitor is connected doesn't
> suspend the system but the monitor shutdown himself.

You'll have to wiggle your mouse I'm afraid, it should bring the display back
to life. It's fixed properly in master, and we have a test that specifically
checks to avoid this particular problem.
Comment 26 Bastien Nocera [gnome-settings-daemon developer] 2013-01-23 21:24:16 UTC
The test case.

commit 50badc695e22722d0f481c744f590fd8d8e39daa
Author: Bastien Nocera <hadess@hadess.net>
Date:   Wed Jan 23 22:19:50 2013 +0100

    power: Additional check in test_no_suspend_lid_close

    Check that we do not blank the screen when closing the lid, and
    a 2nd monitor is plugged in.

    https://bugzilla.gnome.org/show_bug.cgi?id=687277
Comment 27 digimer 2013-02-10 18:05:39 UTC
I registered just to comment on this bug/feature.

I use Gnome 3, love it, and frequently close my laptop's lid while jobs are
running, like running custom backups scripts at night. I understand making
suspend on lid close the default, but totally removing the ability to adjust
this behaviour strikes me as a harmful change with no obvious benefit.

I would really, really like to have the ability to blank the screen on lid
close returned.
Comment 28 Bastien Nocera [gnome-settings-daemon developer] 2013-02-11 07:12:38 UTC
(In reply to comment #27)
> I would really, really like to have the ability to blank the screen on lid
> close returned.

That won't be an option. You can block the lid-switch instead using
systemd-inhibit. Read the bug comments.
Comment 29 digimer 2013-02-11 12:37:31 UTC
I did and I did. However, if the switch isn't used at all, the screen doesn't
blank when closed, as I understand it. So the backlight is left on and it runs
down the batteries. Hardly a good "fix".

Why is it so critical to remove this option from users? What hard could it have
been causing?
Comment 30 Orest Tarasiuk 2013-02-11 17:52:53 UTC
I also utterly disagree with this decision. It seems a bit like copying all the
bad habits or "negative features" from competing products...
Comment 31 Robert Vertesi 2013-02-15 20:03:33 UTC
Orest Tarasiuk:

Exactly. Gnome3 is nice and effective if you can configure it but it's more and
more difficult to. I'm spending my 2nd day searching for extensions and scripts
to configure Gnome3 in such a way that had been half an hour before... I will
never understand why it is good to disable options not used by everyone. It's
cool to hook suspend on the lid but what if it is some users want it an other
way? There were a couple of GOOD reasons listed above. The point is I want to
change it back and forth time by time and not mess with scripts.

Moreover:
I am working with an external monitor with the lid closed. (Which I usually
do.)
I switch to console by Alt+Ctrl+F2 for some reason.
Guess what? 
The computer goes to sleep.
Comment 32 Bastien Nocera [gnome-settings-daemon developer] 2013-02-15 22:27:53 UTC
(In reply to comment #31)
> Moreover:
> I am working with an external monitor with the lid closed. (Which I usually
> do.)
> I switch to console by Alt+Ctrl+F2 for some reason.
> Guess what? 
> The computer goes to sleep.

There's no guessing here. When you're at the console, systemd handles the lid,
not gnome-settings-daemon running in some user's session in an inactive VT, and
it sleeps by default when the lid is closed. Configure logind to not handle the
lid switch, and it won't suspend.
Comment 33 Michael 2013-02-19 19:37:46 UTC
Excuse me for my bad English, I didn't catch one point from the discussion.
Which component is responsible for launching the suspend command on lid closing
(when a user works in the Gnome shell)?
Is it systemd or Gnome shell (i.e. gnome-settings-daemon or something like)?
Comment 34 Robert Vertesi 2013-02-20 11:03:34 UTC
OK, and do you think it's good design? 
I'm trying hard but still do not get why to take away that switch from the user
that made them possible to decide when they want their computer send to sleep
with the lid...

> There's no guessing here. When you're at the console, systemd handles the lid,
> not gnome-settings-daemon running in some user's session in an inactive VT, and
> it sleeps by default when the lid is closed. Configure logind to not handle the
> lid switch, and it won't suspend.
Comment 35 Bastien Nocera [gnome-settings-daemon developer] 2013-02-20 11:16:42 UTC
(In reply to comment #33)
> Excuse me for my bad English, I didn't catch one point from the discussion.
> Which component is responsible for launching the suspend command on lid closing
> (when a user works in the Gnome shell)?
> Is it systemd or Gnome shell (i.e. gnome-settings-daemon or something like)?

systemd will actually suspend the machine when you close the lid. Various
system components can prevent that by using block and delay inhibitors. Office
runner and gnome-settings-daemon are examples of each one of those.

(In reply to comment #34)
> OK, and do you think it's good design? 
> I'm trying hard but still do not get why to take away that switch from the user
> that made them possible to decide when they want their computer send to sleep
> with the lid...

Design doesn't come into it, the options weren't even user visible. From a code
architecture stand-point, we have less moving parts, less bugs, and less corner
cases. and something clean enough that we can have a test suite built on top of
it. And despite the repeated assertions to the contrary, we didn't take away
anything. the logind configuration and systemd-inhibit were mentioned a number
of times in this bug already.

And that discussion *still* doesn't have anything to do with the original bug
report.
Comment 36 Orest Tarasiuk 2013-02-20 22:32:07 UTC
(In reply to comment #35)
> And despite the repeated assertions to the contrary, we didn't take away anything.

What do you mean? In GS 3.4, gnome-settings-daemon respected the gconf key
inhibiting sleep mode on closing the lid. In 3.6, it doesn't.
Comment 37 Bastien Nocera [gnome-settings-daemon developer] 2013-02-20 23:46:21 UTC
(In reply to comment #36)
> (In reply to comment #35)
> > And despite the repeated assertions to the contrary, we didn't take away anything.
> 
> What do you mean? In GS 3.4, gnome-settings-daemon respected the gconf key
> inhibiting sleep mode on closing the lid. In 3.6, it doesn't.

It still does in 3.6 as well as in 3.4. Maybe not in the downstream
distribution you use, but that code upstream is the same as in 3.4. And there
lies the rub. That code didn't work with systemd, and the interaction was
completely broken for a number of cases. systemd works in a certain way, we
adapted our code to work with systemd.

In any case, there's no point carrying on this discussion, I've already
explained how to get your laptop not to suspend when closing the lid.
Comment 38 Orest Tarasiuk 2013-02-20 23:58:19 UTC
(In reply to comment #37)
> (In reply to comment #36)
> > (In reply to comment #35)
> > > And despite the repeated assertions to the contrary, we didn't take away anything.
> > 
> > What do you mean? In GS 3.4, gnome-settings-daemon respected the gconf key
> > inhibiting sleep mode on closing the lid. In 3.6, it doesn't.
> 
> It still does in 3.6 as well as in 3.4. Maybe not in the downstream
> distribution you use, but that code upstream is the same as in 3.4. And there
> lies the rub. That code didn't work with systemd, and the interaction was
> completely broken for a number of cases. systemd works in a certain way, we
> adapted our code to work with systemd.
> 
> In any case, there's no point carrying on this discussion, I've already
> explained how to get your laptop not to suspend when closing the lid.

Okay, this was unknown to me. I'm using Arch and the respective gconf key isn't
considered (this also seems to be the case for other distributions).

If the mentioned code is still in GS 3.6 upstream, what is the preferred method
of inhibiting sleep as viewed from the upstream perspective?
Comment 39 Michael 2013-02-21 13:13:39 UTC
Thank you. As a programmer I've understood the clear design, but I believe the
point is that users (me too as a user) want to customize environment to meet
their normal everyday activity. And they want to do this from the shell. I mean
the Gnome shell, not CLI. And this is the root of the trouble.
Comment 41 Theodore Lee 2013-04-05 01:13:27 UTC
(In reply to comment #40)
> Just install dconf-editor and call it a day. Go to: org > gnome >
> settings-daemon > plugins > power then set "lid-close-ac-action" and
> "lid-close-battery-action" to whatever you need. The default is suspend but if
> you set it to blank or nothing your computer will be able to continue playing
> music, downloading files, running backgrounds tasks, etc. with the lid display
> off but the rest of the unit running just fine.

Unfortunately, I'm pretty sure this hasn't worked since GNOME 3.6. Those keys
are now ignored, so it's impossible to configure GNOME with them (e.g. to
behave differently on lid close on AC vs battery power).
Comment 42 Andrew J. Paradiso 2013-04-05 02:56:26 UTC
(In reply to comment #41)
> (In reply to comment #40)
> > Just install dconf-editor and call it a day. Go to: org > gnome >
> > settings-daemon > plugins > power then set "lid-close-ac-action" and
> > "lid-close-battery-action" to whatever you need. The default is suspend but if
> > you set it to blank or nothing your computer will be able to continue playing
> > music, downloading files, running backgrounds tasks, etc. with the lid display
> > off but the rest of the unit running just fine.
> 
> Unfortunately, I'm pretty sure this hasn't worked since GNOME 3.6. Those keys
> are now ignored, so it's impossible to configure GNOME with them (e.g. to
> behave differently on lid close on AC vs battery power).

I can confirm the methods I listed work. Running Gnome 3.6.3 in Fedora 18.
Comment 43 Theodore Lee 2013-04-05 04:11:29 UTC
Hmm. I'm also running 3.6.3 on Fedora 18, and I can't seem to get my preferred
setup (lid-close-ac-action = blank, lid-close-battery-action = suspend) to work
whether or not systemd is set to handle lid close events. If systemd handles
the lid switch, my system always suspends on lid close, and if not, it always
does nothing. Comment #3 would seem to indicate this is the intended behaviour,
although I guess I should probably do more testing to make sure there's nothing
in my setup getting in the way.
Comment 44 Andrew J. Paradiso 2013-04-05 04:42:24 UTC
(In reply to comment #43)
> Hmm. I'm also running 3.6.3 on Fedora 18, and I can't seem to get my preferred
> setup (lid-close-ac-action = blank, lid-close-battery-action = suspend) to work
> whether or not systemd is set to handle lid close events. If systemd handles
> the lid switch, my system always suspends on lid close, and if not, it always
> does nothing. Comment #3 would seem to indicate this is the intended behaviour,
> although I guess I should probably do more testing to make sure there's nothing
> in my setup getting in the way.

From a clean install of Fedora 18, (not sure what systemd handles it by default
or not, would assume it does) and updating only the kernel (using version
3.8.5) I just simply have to install dconf-editor (version 0.14.1-3.fc18), make
the aforementioned changes and I'm good. Both graphical and command line
methods I mentioned work just fine. To confirm the test, I opened a music video
on YouTube, began playing it before it could fully buffer even, closed the lid
and enjoyed the song in its entirety proving it didn't sleep because A.) It
could play the song and B.) My wi-fi adapter was able to finish loading the
entire stream. 

Not sure how much hardware plays a part in this but I'm using an ASUS R503U
with an AMD E8 1800 1.7GHz x2 64-bit APU with an ATI Radeon HD 7340 chipset.
I'm in legacy bios mode as I disabled the prison that is UEFI.
Comment 47 Andrew J. Paradiso 2013-04-05 05:05:11 UTC
(In reply to comment #43)
> Hmm. I'm also running 3.6.3 on Fedora 18, and I can't seem to get my preferred
> setup (lid-close-ac-action = blank, lid-close-battery-action = suspend) to work
> whether or not systemd is set to handle lid close events. If systemd handles
> the lid switch, my system always suspends on lid close, and if not, it always
> does nothing. Comment #3 would seem to indicate this is the intended behaviour,
> although I guess I should probably do more testing to make sure there's nothing
> in my setup getting in the way.

Just learned that the settings do not persist upon reboot however it remedies
itself if dconf-editor is opened again. The configurations are still the way I
left them so they don't reset upon reboot but apparently aren't read back into
the system until I launch it. Strange... programming is not my skill set;
repairs, design and bug testing are however, but with the problem isolated,
hopefully someone can fix it easily.
Comment 48 Andrew J. Paradiso 2013-04-05 05:31:42 UTC
(In reply to comment #47)
> (In reply to comment #43)
> > Hmm. I'm also running 3.6.3 on Fedora 18, and I can't seem to get my preferred
> > setup (lid-close-ac-action = blank, lid-close-battery-action = suspend) to work
> > whether or not systemd is set to handle lid close events. If systemd handles
> > the lid switch, my system always suspends on lid close, and if not, it always
> > does nothing. Comment #3 would seem to indicate this is the intended behaviour,
> > although I guess I should probably do more testing to make sure there's nothing
> > in my setup getting in the way.
> 
> Just learned that the settings do not persist upon reboot however it remedies
> itself if dconf-editor is opened again. The configurations are still the way I
> left them so they don't reset upon reboot but apparently aren't read back into
> the system until I launch it. Strange... programming is not my skill set;
> repairs, design and bug testing are however, but with the problem isolated,
> hopefully someone can fix it easily.

EDIT: I actually don't need to open the setting again each time. Settings
remain set and condition remedies itself after the first suspend. I.E. Apply
settings, settings work for current session. Reboot, problem returns: system
suspends on lid close, subsequent lid closes that session obey dconf settings.

This is getting weirder by the minute. Not sure what the issue is anymore or if
this is gnome's or systemd's fault anymore but at least I've narrowed this down
a bit.
Comment 49 Olav Vitters [developer] 2013-04-05 07:50:54 UTC
Just a friendly reminder to watch your language. I've hidden a few comments and
also banned a person.
Comment 50 Theodore Lee 2013-04-05 14:04:27 UTC
Ah, after re-reading the earlier comments I see that the config keys in
question were only dropped after 3.6, but Fedora seems to carry cherry picked
patches which probably account for the partially working behaviour. Sorry for
the noise.
Comment 51 Andrew J. Paradiso 2013-04-16 16:13:51 UTC
(In reply to comment #49)
> Just a friendly reminder to watch your language. I've hidden a few comments and
> also banned a person.

I'm sorry Olav. I'm going to keep myself in line from now on.

(In reply to comment #50)
> Ah, after re-reading the earlier comments I see that the config keys in
> question were only dropped after 3.6, but Fedora seems to carry cherry picked
> patches which probably account for the partially working behaviour. Sorry for
> the noise.

So that explains the weird behavior. Anyways, I wanted everyone to know that I
found a clean and pleasant work-around to this that's not nearly as messy as
playing around with inhibitor locks. Hopefully someone can make a GUI solution
in Gnome Tweak Tools or something that can do what I'm about to write here.

All one has to do is uncomment the HandleLidSwitch= line in
/etc/systemd/logind.conf and set the value to lock (This is case-sensitive.
Users can also use "ignore" without quotes if they don't want it to immediately
go to the lock screen) For good measure, you can also uncomment the
LidSwitchIgnoreInhibited= line and change the value from yes to off. (Or add
the lines if they do not exist)

Source: www.freedesktop.org/software/systemd/man/logind.conf.html

I tested this method and it worked on systemd based distros such as Fedora and
Arch. It think it's safe to assume that it will work on all systemd distros.
I'm going to open a feature request to see if someone can implement this clean
solution. All that's left to figure out how to achieve this on distros without
systemd.
Comment 52 Theodore Lee 2013-04-17 00:31:17 UTC
(In reply to comment #51)
> All one has to do is uncomment the HandleLidSwitch= line in
> /etc/systemd/logind.conf and set the value to lock (This is case-sensitive.
> Users can also use "ignore" without quotes if they don't want it to immediately
> go to the lock screen) For good measure, you can also uncomment the
> LidSwitchIgnoreInhibited= line and change the value from yes to off. (Or add
> the lines if they do not exist)

Thank you for this. I was using the logind configuration to work around this
issue, but I was unaware I could make use of options beyond "ignore".

I'm not sure this is something GNOME Tweak Tool could handle though,
considering it's a system configuration file that needs root permissions to
edit. That's not to say there couldn't be a GUI tool for modifying systemd
configuration, but it would probably be outside the GNOME scope.

I'm curious as to how this is handled on non-systemd distros. Do
upstart/initd/etc. have their own event handling, or does it all go straight to
the DE?
Comment 53 Alexander Korsunsky 2013-06-03 21:22:37 UTC
Ok, I did understand how to disable suspending when the lid closes (editing
/etc/systemd/logind.conf)
Now is there a way to *disable* the suspend for AC power and *enable* the
suspend for battery?
Quite frankly, I have little desire to edit system configuration files every
time I plugin in or out my power cord.

Also, will there be graphical settings for this?

(In reply to comment #3)
> The lid-close-{ac,battery}-action keys have been removed.
> We really want lid close to be the way to suspend.

I mean, that's just like your opinion man... But I really don't get the desire
of the GNOME project to force behaviour on people instead of presenting a
choice. If I wanted an operating system that decides over my head what I want
and need, I would use Mac OS.
Note

You need to log in before you can comment on or make changes to this bug.


Attachments


Status: RESOLVED OBSOLETE
Product: gnome-settings-daemon
power
: unspecified
: Linux
: Normal normal
: ---
Assigned To: Richard Hughes
: gnome-settings-daemon-maint
:
:
:
:
  Show dependency tree
 
Reported: 2012-10-31 16:15 UTC by William Ting
Modified: 2013-06-08 05:54 UTC (History)
17 users (show)

See Also:
GNOME target: ---
GNOME version: ---