Hi Guys,
the problem is solved, closing the laptop lid turns off the display, and and opening it, turns it back on.
solution is below:
add the lines below to any file in /etc/acpi/events/
You most likely already have something in there (for me it was sample.conf, I renamed it to acpid.conf so that it's more meaningful).
If you dont have anything in /etc/acpi/events/ create a file (i.e. acpid.conf or lid.conf) as long as the file ends in ".conf" the rest doesn't matter.
Code:
event=button/lid.*
action=/sbin/lidevent
once you added these lines, now you need the /sbin/lidevent file. this is just a shell script like this (it doesnt have be in /sbin or be called lidevent, you can put it anywhere you want and call it anything you want as long as you make the changes in the "action" line accordingly).
so copy the lines below and paste them in /sbin/lidevent
DONT OVERWRITE ANYTHING, if you already have a file with that name and at that location, find out WHAT it is, its best not to overwrite it and just save this script as something else.
Code:
#!/bin/bash
#-----------------------------------------------------------------------------#
# /sbin/lidevent #
# simple script to turn the display on or off when laptop lid is closed #
# By Mahram Z.Foadi #
# Oct 22 2005 #
# thank you linuxquestions.org #
# #
# the following lines must be present in your "/etc/acpi/events/" files. Some #
# systems already have a file called sample.conf in the mentioned directory #
# rename it to something more meaningful (i.e. acpid.conf) and these lines to #
# the end of it (you don't HAVE to rename it, you can even create a new file #
# and call it /etc/acpi/events/lid.conf with the 2 lines in it. If you intend #
# to put this file anywhere other than /sbin/lidevent, make sure you make the #
# proper changes in the "action" line below. For example if you are going to #
# save this script as /usr/bin/mylid.sh then the action line should be: #
# action=/usr/bin/mylid.sh #
# be sure both files are executable, writable, and owned by root ONLY because #
# the acpid daemon is most likely running as root in your system #
# #
# ---- insert the two lines below in /etc/acpi/events/acpid.conf ---- #
# event=button/lid.* #
# action=/sbin/lidevent #
#-----------------------------------------------------------------------------#
# default display on current host
DISPLAY=:0.0
# find out if DPMS is enabled
STATUS=`xset -display $DISPLAY -q | grep -e 'DPMS is'`
# enable DPMS if disabled
if [ "$STATUS" == " DPMS is Disabled" ]
then
echo "Enabling DPMS ..."
xset -display $DISPLAY +dpms
fi
# find out if monitor is on
STATUS=`xset -display $DISPLAY -q | grep 'Monitor'`
if [ "$STATUS" == " Monitor is On" ]
then
echo "[`date`] Turning display OFF"
xset -display $DISPLAY dpms force off
else
echo "[`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
# comment this line out if you're manually running this script from a shell (put a # in front of it)
unset DISPLAY
exit 0
If you don't have your laptop already configured to do this, you're missing out! you save A LOT of battery life with turning off the LCD when you don't need it.
Hope this helps someone out there.
MOD: Maybe this'd be more useful in the laptop forum than general? if you agree please move it accordingly.
Cheers,
Mahram