You are not logged in.

#1 2012-05-04 19:55:51

frette
Member
Registered: 2012-05-04
Posts: 35

[SOLVED] i3 suspend

Hi,

I recently switched to i3 and I'm really loving it. The problem I have now is suspend. Suspend upon closing the lid works via /etc/acpi/handler.sh, but I have yet to manage getting the screen to lock.

here is a snippet of my handler.sh, the i3lock line doesn't work. The commands will be executed as root, so I imagine I have to somehow tell it which user to run as and on what display, but I can't get it to work at all ($USER probably contains root anyway when this is executed, now that I think about it)

   button/lid)
        case "$3" in
            close)
                DISPLAY=:0.0 su -c - $USER /usr/bin/i3lock
                pm-suspend
                ;;
            open)
                ;;
        esac
        ;;

The second problem is auto suspend. It has to auto-suspend after a while (i.e. when I fell asleep). I know I could manage this with xfce4-power-manager or something similar, but this has to be an easy task without bloat I imagine, I just don't know how to do it.

Any suggestions please?

Last edited by frette (2012-05-05 13:14:38)

Offline

#2 2012-05-04 20:03:42

frette
Member
Registered: 2012-05-04
Posts: 35

Re: [SOLVED] i3 suspend

Ok, sometimes it helps just to read what crap I managed to type in a config xD

    button/lid)
        case "$3" in
            close)
                DISPLAY=:0.0 su frette -c /usr/bin/i3lock
                pm-suspend
                ;;
            open)
                ;;
        esac
        ;;

yeah... I simply screwed up the su command before, this works now

Any help on the auto suspend issue is still appreciated, because in this case I don't have the slightest idea how I could do that smile

Last edited by frette (2012-05-04 21:06:48)

Offline

#3 2012-05-04 20:46:38

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: [SOLVED] i3 suspend

Welcome to the forums. For future reference, https://bbs.archlinux.org/help.php#bbcode, specifically code tags. wink

As for "auto-suspend", search the wiki for "suspend idle". One of the results is related to pm-suspend and has an answer. smile


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#4 2012-05-04 21:05:23

frette
Member
Registered: 2012-05-04
Posts: 35

Re: [SOLVED] i3 suspend

yeah, I found that in the meantime already, but there's one problem:
the program suggested is xautolock which calls pm-suspend.
Since pm-suspend has to be run as root, the suggested .xinitrc line for this is:

xautolock -time 30 -locker "sudo pm-suspend" &

This won't work, since I don't have (and will not install) sudo, and for this to work you would also have to disable password query for sudo pm-suspend, which kinda lets me scream inside.

I also stumbled upon sleepd though, which sadly doesn't want to compile right now, but I will look into that, it looks promising.

Last edited by frette (2012-05-04 21:08:14)

Offline

#5 2012-05-05 12:29:13

frette
Member
Registered: 2012-05-04
Posts: 35

Re: [SOLVED] i3 suspend

finally I got the handler.sh script the way I wanted (without hardcoded user), and it's even in the wiki, I must have overread this part:

    button/lid)
        case "$3" in
            close)
                getuser "$user"
                echo $user > /dev/tty5
                DISPLAY=:0.0 su $user -c /usr/bin/i3lock
                pm-suspend
                ;;
            open)
                ;;
        esac
        ;;

And I'm still looking for a more suitable way to make autosuspend after an hour happening btw., so any more suggestions would be welcome.

edit: I have split off the autosuspend questio to another thread https://bbs.archlinux.org/viewtopic.php … 1#p1097541 and will mark this as solved (since the main part is and the autolock solution would work for most people too I guess).

Last edited by frette (2012-05-05 13:13:54)

Offline

Board footer

Powered by FluxBB