From: Gregory SACRE <gregory.sacre@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Laptop Lid Close...
Date: Fri, 23 Jan 2009 15:57:31 +0100 [thread overview]
Message-ID: <5e213dd40901230657s28dec766n108f2352bd2e9e6b@mail.gmail.com> (raw)
In-Reply-To: <c30988c30901222314u78507ef1tde0510675b835f8a@mail.gmail.com>
This is the script I am using. It is spawned by the default.sh from /etc/acpi:
-------------------------- SCRIPT START --------------------------
# default display on current host
export XAUTHORITY="/home/<your_user>/.Xauthority"
DISPLAY=:0.0
# find out if monitor is on
STATUS=`cat /proc/acpi/button/lid/LID0/state`
logger "monitor: $STATUS"
# find out if DPMS is enabled
DPMS=`xset -display $DISPLAY -q | grep -e 'DPMS is'`
logger "dpms: $DPMS"
# enable DPMS if disabled
if [ "$DPMS" == " DPMS is Disabled" ]
then
logger "Enabling DPMS ..."
xset -display $DISPLAY +dpms
fi
if [ `echo $STATUS | grep -i closed | wc -l` -eq 1 ]
then
logger "[`date`] Turning display OFF"
xset -display $DISPLAY dpms force off
else
logger "[`date`] Turning display ON" # shows up in log
xset -display $DISPLAY dpms force on # turn monitor on
xset -display $DISPLAY s activate # un-blank monitor
fi
#clean up
unset STATUS
unset DPMS
# comment this line out if you're manually running this script from a
shell (put a # in front of it)
unset DISPLAY
exit 0
-------------------------- SCRIPT STOP --------------------------
Change the <your_user> variable.
I had also to set xscreensaver to switch off my monitor instead of
blanking it, because I think (not sure) that xscreensaver was
switching on my monitor when it was supposed to start the screensaver
(as after a while, my monitor was switched back on, and as I didn't
see that happening since my xscreensaver modification, I can only
assume that was the problem).
HTH,
Greg
On Fri, Jan 23, 2009 at 8:14 AM, Joshua Murphy <poisonbl@gmail.com> wrote:
> On Thu, Jan 22, 2009 at 8:24 PM, BRM <bm_witness@yahoo.com> wrote:
>> 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.
>>
>> 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.
>>
>> 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.
>>
>> Any how...I'd really like to get this working.
>>
>> TIA,
>>
>> Ben
>
> In...
> /etc/acpi/default.sh
>
> there's a comment (with commented code you can use following it)...
> # if your laptop doesnt turn on/off the display via hardware
> # switch and instead just generates an acpi event, you can force
> # X to turn off the display via dpms. note you will have to run
> # 'xhost +local:0' so root can access the X DISPLAY.
>
> if radeontool or something will allow you to disable the display even
> when you aren't in X, or without proper access to the display (like
> xset requires) you might be able to even escape needing that xhost
> setting. No way of testing it at all myself though.
>
> --
> Poison [BLX]
> Joshua M. Murphy
>
>
next prev parent reply other threads:[~2009-01-23 14:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-23 1:24 [gentoo-user] Laptop Lid Close BRM
2009-01-23 7:14 ` Joshua Murphy
2009-01-23 14:57 ` Gregory SACRE [this message]
2009-01-24 3:58 ` BRM
2009-01-26 16:32 ` Gregory SACRE
2009-01-26 17:59 ` BRM
2009-01-29 15:50 ` BRM
2009-01-24 16:21 ` Brandon Vargo
[not found] <bXj1Y-7bf-1@gated-at.bofh.it>
2009-01-25 14:59 ` Gian Calgeer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5e213dd40901230657s28dec766n108f2352bd2e9e6b@mail.gmail.com \
--to=gregory.sacre@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox