You are not logged in.

#1 2011-07-28 20:28:52

Shark
Member
From: /dev/zero
Registered: 2011-02-28
Posts: 686

[SOLVED]handler.sh and pm-suspend

Hi

I have no screensaver and no DM. I have installed pm-utils and slock. So  when i close my lid i want to suspend the laptop and lock the screen with slock. In /etc/acpi/handler.sh under button/lid i wrote:

pm-suspend && slock

but this just suspend the computer without locking the screen.

What am i missing here?

Thanks!

Last edited by Shark (2011-08-15 08:55:57)


If you have built castles in the air, your work need not be lost; that is where they should be. Now put foundations under them.
Henry David Thoreau

Registered Linux User: #559057

Offline

#2 2011-07-28 20:50:22

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: [SOLVED]handler.sh and pm-suspend

     button/lid)
         if [ `/bin/awk '{print $2}' /proc/acpi/button/lid/LID/state` = closed ]; then
                 DISPLAY=:1.0 su -c - firecat53 /usr/local/bin/lock.sh
                 /usr/sbin/pm-suspend 
         fi
         ;;

The key is setting the DISPLAY since slock is an X program. I had some other pre-suspend stuff in my lock.sh script, but you can just use /usr/bin/slock. You can also play with and see which works better: having slock run before or after the suspend.

Good luck!
Scott

Last edited by firecat53 (2011-07-28 20:51:25)

Offline

#3 2011-07-28 21:33:41

Shark
Member
From: /dev/zero
Registered: 2011-02-28
Posts: 686

Re: [SOLVED]handler.sh and pm-suspend

Hi

Thanks for help but that doesn't work. I even changed /usr/local/bin/lock.sh to /usr/bin/slock but doesn't do the trick.


If you have built castles in the air, your work need not be lost; that is where they should be. Now put foundations under them.
Henry David Thoreau

Registered Linux User: #559057

Offline

#4 2011-08-15 08:55:31

Shark
Member
From: /dev/zero
Registered: 2011-02-28
Posts: 686

Re: [SOLVED]handler.sh and pm-suspend

firecat53 wrote:
     button/lid)
         if [ `/bin/awk '{print $2}' /proc/acpi/button/lid/LID/state` = closed ]; then
                 DISPLAY=:1.0 su -c - firecat53 /usr/local/bin/lock.sh
                 /usr/sbin/pm-suspend 
         fi
         ;;

The key is setting the DISPLAY since slock is an X program. I had some other pre-suspend stuff in my lock.sh script, but you can just use /usr/bin/slock. You can also play with and see which works better: having slock run before or after the suspend.

Good luck!
Scott

Thanks man now it works. I did:

/usr/sbin/pm-suspend 
DISPLAY=:0.0 su -c - shark /usr/bin/slock

Last edited by Shark (2011-08-15 08:56:39)


If you have built castles in the air, your work need not be lost; that is where they should be. Now put foundations under them.
Henry David Thoreau

Registered Linux User: #559057

Offline

Board footer

Powered by FluxBB