You are not logged in.

#1 2010-06-24 03:13:18

obankobi
Member
Registered: 2010-04-21
Posts: 26

Flux Box lock screen after sleep

I (finally) got flux to go to sleep when I close the laptop lid, but when it wakes up, it's right there where I left it, no login or anything. Besides logging out before hand, is there a way to get it to lock when it goes to sleep? I found a solution that "sort of" works, I added xlock to the key that causes it to wake from sleep, but it flickers the desktop for a bit of a second, so I was wondering if there was another way.

While we're at it, how do you get a laptop to go to sleep when you close the lid? I have to close then open mine, as it only seems to sense the opening, though obviously Windows senses it close. I've been using xev to log key presses, but it doesn't seem to pick up the closing action.

Offline

#2 2010-07-02 01:14:17

obankobi
Member
Registered: 2010-04-21
Posts: 26

Re: Flux Box lock screen after sleep

Bumpity bump.

Offline

#3 2010-07-02 05:57:11

cantabile
Member
Registered: 2010-06-29
Posts: 33

Re: Flux Box lock screen after sleep

/etc/acpi/handler.sh is the file you're looking for. It should already contain a "button/lid" branch. Put this there:

grep -q closed /proc/acpi/button/lid/C154/state && (xlock &) && pm-suspend

You will have to substitute 'C154' for whatever you have, and 'pm-suspend' for whatever you use to suspend.
Naturally, the acpid daemon needs to be running.

Now, the above assumes closing the lid immediately generates an acpi event, which may not be the case, based on what you said.

I have to close then open mine, as it only seems to sense the opening,

To test, either do as I suggest above, or run `acpi_listen -t 10`, close the lid, wait 15 seconds, open it and see if acpi_listen shows something like this:

button/lid C154 00000080 00000005

I also assume you got this thing to halfway work using something other than acpid's handler.sh. Therefore, before you try with acpid, make sure the other method is disabled (unless you want it to suspend twice in a row or something like that).

edit:
I forgot to say (though it's rather obvious): the key is to lock the screen before you suspend. smile

Last edited by cantabile (2010-07-02 05:59:26)

Offline

#4 2010-07-02 16:36:01

obankobi
Member
Registered: 2010-04-21
Posts: 26

Re: Flux Box lock screen after sleep

Thanks for the reply, I'm a wee busy to try it at the moment, but I do have one quick question. If I lock the screen first, it doesn't continue running the command until I unlock it...That's not really a question , is it. How do I it to lock AND run the sleep command? I currently have it as s2ram -f ; lock. If I write it as lock; s2ram -f, it locks and doesn't sleep, until I unlock. Oh wait, one more Q smile the suspend command, s2ram, needs to be sudo'd. If I'm not logged in as root or sudoing in a terminal, it does nothing. Is there a way to get around that?

Offline

#5 2010-07-02 16:42:51

cantabile
Member
Registered: 2010-06-29
Posts: 33

Re: Flux Box lock screen after sleep

obankobi wrote:

Thanks for the reply, I'm a wee busy to try it at the moment, but I do have one quick question. If I lock the screen first, it doesn't continue running the command until I unlock it...That's not really a question , is it. How do I it to lock AND run the sleep command? I currently have it as s2ram -f ; lock. If I write it as lock; s2ram -f, it locks and doesn't sleep, until I unlock. Oh wait, one more Q smile the suspend command, s2ram, needs to be sudo'd. If I'm not logged in as root or sudoing in a terminal, it does nothing. Is there a way to get around that?

smile

(xlock &) && s2ram -f

That will launch xlock in the background, and s2ram is executed right away.

/etc/acpi/handler.sh is run with root privileges - no sudo required.

Offline

#6 2010-07-02 16:57:06

obankobi
Member
Registered: 2010-04-21
Posts: 26

Re: Flux Box lock screen after sleep

Ah, thanks smile

Whats C154 represent?

Last edited by obankobi (2010-07-02 17:05:59)

Offline

Board footer

Powered by FluxBB