1 |
On Wed, 11 Mar 2009 18:41:56 -0400 |
2 |
Saphirus Sage <saphirus497@×××××.com> wrote: |
3 |
|
4 |
> The issue I've run into is that this will cause my laptop to suspend to |
5 |
> the RAM upon any change in the lid state, irregardless of if it is open |
6 |
> or closed. I tried to be more specific by utilizing the suffix of the |
7 |
> event, but it's incremental, which is a bit beyond my abilities. Any |
8 |
> suggestions to make this suspend only when the lid is closed? |
9 |
|
10 |
This one seem to be working for me: |
11 |
|
12 |
#!/bin/sh |
13 |
if grep closed /proc/acpi/button/lid/LID0/state &>/dev/null |
14 |
then echo "Lid closed, suspending..." |
15 |
else echo "Lid is open, doing nothing" |
16 |
fi |
17 |
|
18 |
|
19 |
Then, you can just put it to, say, crontab, with a line like this: |
20 |
|
21 |
*/5 * * * * /path/to/script.sh |
22 |
|
23 |
...which'll make it run every five minutes, so the laptop will be |
24 |
suspended within five mins of closing the lid, which should also |
25 |
prevent accidental closing events. |
26 |
|
27 |
|
28 |
Of course, you should put your actions to the aforementioned script, if |
29 |
you want it to do something useful, instead of just experimental echo. |
30 |
|
31 |
|
32 |
-- |
33 |
Mike Kazantsev // fraggod.net |