You are not logged in.

#1 2011-09-15 00:01:55

shadyabhi
Member
From: Bangalore
Registered: 2010-05-23
Posts: 262
Website

[SOLVED] Lock the screen when opening lid after sleep

In my /etc/acpi/handler.sh

    button/lid)
        #echo "LID switched!">/dev/tty5
        if [ -n "`grep close /proc/acpi/button/lid/LID0/state`" ]; then
            /usr/sbin/pm-suspend
            logger -s "ACPI lid closed";
        elif [ -n "`grep open /proc/acpi/button/lid/LID0/state`" ]; then
            logger -s "ACPI lid opened"
            /home/skr/.brightness.sh down
            DISPLAY=:0.0 /usr/bin/xlock
        else
            logger -s "Couldn't detect Lid state"
        fi
        ;;

I am not able to lock my screen after resume. If I enter xlock in terminal, it works, but its not working this way.

What is going wrong here?

Last edited by shadyabhi (2011-09-18 00:47:05)

Offline

#2 2011-09-16 13:04:07

Barafu Albino Cheetah
Member
From: Moscow
Registered: 2011-09-16
Posts: 34

Re: [SOLVED] Lock the screen when opening lid after sleep

The first thought is that DISPLAY does not default to 0:0 and even can change after ACPI suspend. If this is not the case try

DISPLAY=:0

Offline

#3 2011-09-16 16:10:03

Proofrific
Member
Registered: 2008-01-05
Posts: 215

Re: [SOLVED] Lock the screen when opening lid after sleep

Barafu Albino Cheetah wrote:

The first thought is that DISPLAY does not default to 0:0 and even can change after ACPI suspend. If this is not the case try

DISPLAY=:0

Note that Barafu is referring to an environmental variable here. To see what it is, try `env | grep DISPLAY` in the command-line.

Offline

#4 2011-09-16 16:41:26

Barafu Albino Cheetah
Member
From: Moscow
Registered: 2011-09-16
Posts: 34

Re: [SOLVED] Lock the screen when opening lid after sleep

Well, he is using it right, the only thing I am questioning is the value.

Offline

#5 2011-09-16 17:36:49

shadyabhi
Member
From: Bangalore
Registered: 2010-05-23
Posts: 262
Website

Re: [SOLVED] Lock the screen when opening lid after sleep

Trying changind DISPLAY=:0

Still not able to lock. I ever tried

DISPLAY=:0 /usr/bin/xlock 2>&1 > /tmp/lock_log

Nothing in the log even.

Offline

#6 2011-09-16 20:12:47

Barafu Albino Cheetah
Member
From: Moscow
Registered: 2011-09-16
Posts: 34

Re: [SOLVED] Lock the screen when opening lid after sleep

Check if your config is being started at all. try

 echo "I'm here!" > /tmp/lock_log. 

If is does, remove that /home/skr/.brightness.sh down line. If that script fails to exit, all will hang up.

Offline

#7 2011-09-17 22:55:06

shadyabhi
Member
From: Bangalore
Registered: 2010-05-23
Posts: 262
Website

Re: [SOLVED] Lock the screen when opening lid after sleep

Barafu Albino Cheetah wrote:

Check if your config is being started at all. try

 echo "I'm here!" > /tmp/lock_log. 

If is does, remove that /home/skr/.brightness.sh down line. If that script fails to exit, all will hang up.


Removed the brightness line. This time the brightness was not changed (reduced) so I can confirm that part is executed.

Still nothing in the log.

Offline

#8 2011-09-18 00:40:01

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [SOLVED] Lock the screen when opening lid after sleep

Have a look at the following handler.sh if it helps you.

https://wiki.archlinux.org/index.php/Le … handler.sh

Regards

Offline

#9 2011-09-18 00:45:28

shadyabhi
Member
From: Bangalore
Registered: 2010-05-23
Posts: 262
Website

Re: [SOLVED] Lock the screen when opening lid after sleep

Oh, how could I miss the wiki.

Changed the line to

DISPLAY=:0 su -c - skr /usr/bin/xlock

and now it works perfectly.

Offline

Board footer

Powered by FluxBB