You are not logged in.

#1 2012-03-29 11:27:25

n125
Member
Registered: 2011-12-30
Posts: 38

Slimlock stopped working with handler.sh?

I apologize if I posted this to the wrong section.

Since I run Openbox, I use the handler.sh script to manage ACPI events. Until some weeks ago, I had no problems using this script to suspend and lock my laptop when I closed its lid, but now for some reason, slimlock no longer works when executed by the script. It just resumes right back to where it left off.

I edited my handler.sh using this example on the wiki:

button/lid)
    case $3 in
        close)
            #echo "LID switched!">/dev/tty5
	     /usr/sbin/pm-suspend &
	     DISPLAY=:0.0 su -c - username /usr/bin/slimlock // And yeah, my username is set here.
            ;;

When I map "DISPLAY=:0.0 su -c - username /usr/bin/slimlock" to another function hotkey using handler.sh, all that happens is my screen blanks for a split second. If I exclude "DISPLAY=:0.0" from that line, because I'm down to just trying arbitrary things, the same thing happens.

Entering "DISPLAY=:0.0 su -c - username /usr/bin/slimlock" into a terminal causes my screen to blank for a split second, just as above. There are no error message or anything. Slimlock locks my screen as expected if I enter "/usr/bin/slimlock" or just "slimlock" - but if I try this in handler.sh, nothing happens.

I'm not that great with scripting so I don't know where to even begin.

Thanks.

Offline

#2 2012-03-29 11:39:20

hesse
Member
Registered: 2011-12-08
Posts: 88

Re: Slimlock stopped working with handler.sh?

It seems you try to exec suspend in the background while execing the lock command. Try locking the screen and then suspend the machine:

button/lid)
    case $3 in
        close)
            #echo "LID switched!">/dev/tty5
	     DISPLAY=:0.0 su -c - username /usr/bin/slimlock
	     /usr/sbin/pm-suspend
            ;;

You say it used to work: maybe the acpi event codes have changed so you need to check these by running acpi_listen while closing/opening the lid and adjust accordingly.

P.S. Using // for comments is not allowed in bash scripts - use hash signs # for that. I assume you just added it for explaination.

Last edited by hesse (2012-03-29 11:40:26)

Offline

#3 2012-03-29 12:08:04

n125
Member
Registered: 2011-12-30
Posts: 38

Re: Slimlock stopped working with handler.sh?

Thanks for the reply. Yes, the // comment was just for explanation.

Trying to lock the screen and then suspend did not work.

handler.sh picks up the event just fine so I don't think the event codes have changed; I mean, when I close the lid it does suspend as it should. It's just that for whatever reason, slimlock just doesn't run properly when executed by handler.sh.

Offline

#4 2012-04-08 09:26:10

n125
Member
Registered: 2011-12-30
Posts: 38

Re: Slimlock stopped working with handler.sh?

Sorry for the bump, but I'm still struggling with this.

To reiterate my problem, slimlock no longer seems to run properly when executed by handler.sh. It used to work just fine, but as of some time in late Februrary or early March, it stopped. I just modified handler.sh as recommended by the wiki (see OP), so I haven't done anything fancy. These are my observations:

  • Manually entering "slimlock" or "/usr/bin/slimlock" into a terminal locks my screen correctly, suggesting that there is nothing wrong with slimlock.

  • handler.sh responds to ACPI events correctly; it executes pm-suspend when I close my laptop's lid, the power button and sleep buttons work, and so on.

  • Including "DISPLAY=:0.0 su -c - myusername /usr/bin/slimlock" in handler.sh, as recommended by the wiki, does not work anymore. No permutation of this statement executes slimlock correctly when read by handler.sh. Also, manually entering this line into a terminal just causes my screen to blank for a fraction of a second, as if slimlock is trying to load and then suddenly fails.

Any more ideas would be appreciated.

Offline

Board footer

Powered by FluxBB