The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

How to prevent sleep on laptop lid close?

asked 2015-03-18 15:02:29 +0000

maki57 gravatar image

updated 2015-03-20 11:11:39 +0000

Adaephon gravatar image

Sort of like an antithesis to this question.

I'd like to know how to avoid my laptop from sleeping on lid close which seems to be the default functionality after a fresh install of i3.

In addition to that, how should I go about setting things to happen once the lid closes like lock and turn off the screen (and just the screen)?

I'm running Ubuntu 14.04.

edit retag flag offensive close merge delete

Comments

you can have a look in you `/etc/apci/` folder. There could be some events and scripts that get triggered depending on certain ACPI-critical buttons

mschaefer gravatar imagemschaefer ( 2015-03-18 15:07:04 +0000 )edit

None of the scripts I found there refer to lid-related events. Mostly just stuff on brightness, power or wireless.

maki57 gravatar imagemaki57 ( 2015-03-19 01:02:43 +0000 )edit

The configuration depends on your OS and distribution. Some Linux distributions use `/etc/systemd/logind.conf` to set the behaviour. There should be a line with `HandleLidSwitch` in there. Uncomment it and set it to `lock`. If this does not do what you want, set it to `ignore` and go from there.

Adaephon gravatar imageAdaephon ( 2015-03-19 05:57:56 +0000 )edit

I'm using Ubuntu (I'll edit that in). `HandleLidSwitch` is commented out already in that file.

maki57 gravatar imagemaki57 ( 2015-03-19 10:45:59 +0000 )edit
1

What I meant with "uncomment" was to remove the comment sign (`#`). And then change the value to `lock` or `ignore`, at the moment it is probably `suspend`.

Adaephon gravatar imageAdaephon ( 2015-03-19 12:25:33 +0000 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-03-20 11:08:37 +0000

Adaephon gravatar image

The configuration depends on your OS and distribution.

Some Linux distributions use /etc/systemd/logind.conf to set the behaviour.

There should be a line with HandleLidSwitch under section [Login] in there. On Ubuntu (at least on 14.*) and Arch it is commented out by default, showing the default setting:

[Login]
# [...]
#HandleLidSwitch=suspend
# [...]

To change the settings you have to uncomment the line and change the value.

According to the logind.conf(5) manpage if you set it to lock

[...] all running sessions will be screen locked.

[Login]
# [...]
HandleLidSwitch=lock
# [...]

This may or may not work with i3, it probably again depends on the distribution and display manager.


If it does not do what you want, set HandleLidSwitch to ignore:

[Login]
# [...]
HandleLidSwitch=ignore
# [...]

This will at least prevent the machine from going to sleep.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2015-03-18 15:02:29 +0000

Seen: 1,103 times

Last updated: Mar 20