1 |
This is the script I am using. It is spawned by the default.sh from /etc/acpi: |
2 |
|
3 |
-------------------------- SCRIPT START -------------------------- |
4 |
# default display on current host |
5 |
export XAUTHORITY="/home/<your_user>/.Xauthority" |
6 |
DISPLAY=:0.0 |
7 |
|
8 |
# find out if monitor is on |
9 |
STATUS=`cat /proc/acpi/button/lid/LID0/state` |
10 |
logger "monitor: $STATUS" |
11 |
|
12 |
# find out if DPMS is enabled |
13 |
DPMS=`xset -display $DISPLAY -q | grep -e 'DPMS is'` |
14 |
logger "dpms: $DPMS" |
15 |
|
16 |
# enable DPMS if disabled |
17 |
if [ "$DPMS" == " DPMS is Disabled" ] |
18 |
then |
19 |
logger "Enabling DPMS ..." |
20 |
xset -display $DISPLAY +dpms |
21 |
fi |
22 |
|
23 |
if [ `echo $STATUS | grep -i closed | wc -l` -eq 1 ] |
24 |
then |
25 |
logger "[`date`] Turning display OFF" |
26 |
xset -display $DISPLAY dpms force off |
27 |
else |
28 |
logger "[`date`] Turning display ON" # shows up in log |
29 |
xset -display $DISPLAY dpms force on # turn monitor on |
30 |
xset -display $DISPLAY s activate # un-blank monitor |
31 |
fi |
32 |
|
33 |
#clean up |
34 |
unset STATUS |
35 |
unset DPMS |
36 |
|
37 |
# comment this line out if you're manually running this script from a |
38 |
shell (put a # in front of it) |
39 |
unset DISPLAY |
40 |
|
41 |
exit 0 |
42 |
-------------------------- SCRIPT STOP -------------------------- |
43 |
|
44 |
Change the <your_user> variable. |
45 |
I had also to set xscreensaver to switch off my monitor instead of |
46 |
blanking it, because I think (not sure) that xscreensaver was |
47 |
switching on my monitor when it was supposed to start the screensaver |
48 |
(as after a while, my monitor was switched back on, and as I didn't |
49 |
see that happening since my xscreensaver modification, I can only |
50 |
assume that was the problem). |
51 |
|
52 |
|
53 |
HTH, |
54 |
|
55 |
Greg |
56 |
|
57 |
|
58 |
On Fri, Jan 23, 2009 at 8:14 AM, Joshua Murphy <poisonbl@×××××.com> wrote: |
59 |
> On Thu, Jan 22, 2009 at 8:24 PM, BRM <bm_witness@×××××.com> wrote: |
60 |
>> I'm running a Dell D600, and I've located a number of tools for it but I am not seeing anything related to when I close the lid. Since I got Gentoo running on it, the Monitor continues running when I close the lid. |
61 |
>> |
62 |
>> I've found several sources for doing something as an ACPI event, which seems to be the right method. I can toggle the button with the lid open and cat /etc/acpi/button/lid/LID/state and see it change between 'open' and 'closed'; and I know I could write myself a little script do something like calling radeontool to turn off the backlight, but I'd like to find a more official method. |
63 |
>> |
64 |
>> I mostly run KDE 3.5 (I'll go to KDE4 when I can...once portage 2.2 comes out and all), but I didn't see anything for a 'turn off monitor on lid close' setting (preferrably root controlled so that it affects all users). The only thing I can find is a the standby/suspend/shutdown/logoff, system performance, and CPU throttling. I don't really want to do any of that - just put the monitor into stand-by, not necessarily the whole system. |
65 |
>> |
66 |
>> Any how...I'd really like to get this working. |
67 |
>> |
68 |
>> TIA, |
69 |
>> |
70 |
>> Ben |
71 |
> |
72 |
> In... |
73 |
> /etc/acpi/default.sh |
74 |
> |
75 |
> there's a comment (with commented code you can use following it)... |
76 |
> # if your laptop doesnt turn on/off the display via hardware |
77 |
> # switch and instead just generates an acpi event, you can force |
78 |
> # X to turn off the display via dpms. note you will have to run |
79 |
> # 'xhost +local:0' so root can access the X DISPLAY. |
80 |
> |
81 |
> if radeontool or something will allow you to disable the display even |
82 |
> when you aren't in X, or without proper access to the display (like |
83 |
> xset requires) you might be able to even escape needing that xhost |
84 |
> setting. No way of testing it at all myself though. |
85 |
> |
86 |
> -- |
87 |
> Poison [BLX] |
88 |
> Joshua M. Murphy |
89 |
> |
90 |
> |