VectorLinux
April 23, 2014, 12:52:18 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: [SOLVED] Lock screen when i close the lid for VL5.9  (Read 1853 times)
hata_ph
Packager
Vectorian
****
Posts: 3210


-- Just being myself --


« on: January 19, 2008, 08:13:38 pm »

I just read a howto hibernate for VL5.9 from MOE-Inx and I wonder can I modify the part of the tutorial to auto lock the screen when I close the lid.

Quote
Automating the process

If all of the above has worked so far, it's time to do some automating.

This will make your machine suspend when you close the lid
execute all of these commands as root user

mv /etc/rc.d/rc.acpi /etc/rc.d/rc.acpi.bk

Create a new directory to automate the process

mkdir -p /etc/rc.d/acpid/{events,actions}

Create a script for the lid switch event. Copy this text and paste it to /etc/rc.d/acpid/events/lid

event=button[ /]lid.*
action=/etc/acpi/actions/lid.sh


Create another script that will actually run the script when this event gets triggered.
Copy this text and paste it in /etc/rc.d/acpid/actions/lid.sh

#!/bin/sh
/usr/local/sbin/suspend.sh

Set the script to be executable

chmod +x /etc/rc.d/acpid/actions/lid.sh


You're all set

can I just modify the /etc/acpi/actions/lid.sh as below to
Quote
#!/bin/sh
/usr/bin/xflock4
to run the xflock4 in xfce....

i haven't try it yet as I am not very sure what is the different of rc.acpi and rc.acpid.......and this command "mv /etc/rc.d/rc.acpi /etc/rc.d/rc.acpi.bk" really make me think twice before doing it as I scare to screw up my newly installed VL5.9...
any advise is a welcome for me to more understand it....thanks....

Or...is there another way of doing it....
« Last Edit: January 20, 2008, 01:21:55 am by hata_ph » Logged
hata_ph
Packager
Vectorian
****
Posts: 3210


-- Just being myself --


« Reply #1 on: January 20, 2008, 01:21:29 am »

I have done it but the step is not totally 100% same with MOE-Inx's howto......
instead of create the lid script in /etc/rc.d/acpid/events I just put the file in /etc/acpi/events
and I create the lid.sh in /etc/acpi/actions and restart the acpi daemon by using typing /etc/rc.d/rc.acpid restart in root

I did not rename the /etc/rc.d/rc.acpi to /etc/rc.d/rc.acpi.bk
there is no need for me to create the acpid folder inside /etc/rc.d too......
however when the lid.sh execute when I close the lid there is some error prompt up from the xscreensaver........below is the log from /var/log/acpid

Quote
[Sun Jan 20 17:03:09 2008] received event "button/lid C169 00000080 00000010"
[Sun Jan 20 17:03:09 2008] notifying client 2874[0:0]
[Sun Jan 20 17:03:09 2008] executing action "/etc/acpi/actions/lid.sh"
[Sun Jan 20 17:03:09 2008] BEGIN HANDLER MESSAGES
xscreensaver-command: warning: $DISPLAY is not set: defaulting to ":0.0".
xscreensaver-command: already locked.

[Sun Jan 20 17:03:19 2008] END HANDLER MESSAGES
[Sun Jan 20 17:03:19 2008] action exited with status 0
[Sun Jan 20 17:03:19 2008] executing action "/etc/acpi/acpi_handler.sh button/lid C169 00000080 00000010"
[Sun Jan 20 17:03:19 2008] BEGIN HANDLER MESSAGES
/etc/acpi/acpi_handler.sh: line 14: /proc/acpi/button/lid/LID/state: No such file or directory
[Sun Jan 20 17:03:19 2008] END HANDLER MESSAGES
[Sun Jan 20 17:03:19 2008] action exited with status 0
[Sun Jan 20 17:03:19 2008] completed event "button/lid C169 00000080 00000010"
[Sun Jan 20 17:05:56 2008] exiting
[Sun Jan 20 17:05:57 2008] starting up
[Sun Jan 20 17:05:57 2008] 2 rules loaded
[Sun Jan 20 17:05:58 2008] client connected from 2874[0:0]
[Sun Jan 20 17:05:58 2008] 1 client rule loaded
[Sun Jan 20 17:06:01 2008] received event "button/lid C169 00000080 00000011"
[Sun Jan 20 17:06:01 2008] notifying client 2874[0:0]
[Sun Jan 20 17:06:01 2008] executing action "/etc/acpi/actions/lid.sh"
[Sun Jan 20 17:06:01 2008] BEGIN HANDLER MESSAGES
xscreensaver-command: xscreensaver window unexpectedly deleted.
[Sun Jan 20 17:06:04 2008] END HANDLER MESSAGES
[Sun Jan 20 17:06:04 2008] action exited with status 0
[Sun Jan 20 17:06:04 2008] executing action "/etc/acpi/acpi_handler.sh button/lid C169 00000080 00000011"
[Sun Jan 20 17:06:04 2008] BEGIN HANDLER MESSAGES
/etc/acpi/acpi_handler.sh: line 14: /proc/acpi/button/lid/LID/state: No such file or directory
[Sun Jan 20 17:06:04 2008] END HANDLER MESSAGES
[Sun Jan 20 17:06:04 2008] action exited with status 0
[Sun Jan 20 17:06:04 2008] completed event "button/lid C169 00000080 00000011"
[Sun Jan 20 17:06:05 2008] received event "button/lid C169 00000080 00000012"
[Sun Jan 20 17:06:05 2008] notifying client 2874[0:0]
[Sun Jan 20 17:06:05 2008] executing action "/etc/acpi/actions/lid.sh"
[Sun Jan 20 17:06:05 2008] BEGIN HANDLER MESSAGES
xscreensaver-command: already locked.

[Sun Jan 20 17:06:12 2008] END HANDLER MESSAGES
[Sun Jan 20 17:06:12 2008] action exited with status 0
[Sun Jan 20 17:06:12 2008] executing action "/etc/acpi/acpi_handler.sh button/lid C169 00000080 00000012"
[Sun Jan 20 17:06:12 2008] BEGIN HANDLER MESSAGES
/etc/acpi/acpi_handler.sh: line 14: /proc/acpi/button/lid/LID/state: No such file or directory
[Sun Jan 20 17:06:12 2008] END HANDLER MESSAGES
[Sun Jan 20 17:06:12 2008] action exited with status 0
[Sun Jan 20 17:06:12 2008] completed event "button/lid C169 00000080 00000012"

but if run from normal the xflock4 work without any error......strange....

btw, the lid.sh should be written like below instead of the original script from MOE-Inx how-to (without the bracket)...
Quote
event=button/lid.*
action=/etc/acpi/actions/lid.sh

below link is a good howto and tutorial for ACPI....
http://www.columbia.edu/~ariel/acpi/acpi_howto.txt
Logged
rbistolfi
Packager
Vectorian
****
Posts: 2265


« Reply #2 on: January 20, 2008, 05:04:41 am »

Hi hata,

Looks like acpid is executing two scripts on lid closure, yours and /etc/acpi/acpi_handler.sh
You could comment the lid section in the last (the "lid)" part) or just move it.
I dunno about the xscreensaver error.
Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
hata_ph
Packager
Vectorian
****
Posts: 3210


-- Just being myself --


« Reply #3 on: January 20, 2008, 05:09:23 am »

I just try disable the acpi_handler.sh but the xscreensaver error still occur.....
but then it just a minor issue which I am able to live with it... Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!