2

I'm in fluxbox on Arch on a Macbook 5,1. New to linux. I'm trying to get Arch to suspend when I close my laptop. Lately I've just been using sudo pm-suspend.

I installed slimlock, and inserted

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

in my /etc/acpi/handler.sh, which I read to do here, but it doesn't work. I tried installing xscreensaver, but I get a weird error:

error: perl-lwp-mediatypes: signature from "Justin Davis (juster) <jrcd83@gmail.com>" is unknown trust
error: failed to commit transaction (invalid or corrupted package (PGP signature))
1

You will need to install archlinux-keyring package to have all needed public key.

pacman -S archlinux-keyring

More information here.

Also you should lock first, suspend later:

button/lid)
    case $3 in
        close)
            #echo "LID switched!">/dev/tty5
            DISPLAY=:0.0 su -c - username /usr/bin/slimlock &
            /usr/sbin/pm-suspend
            ;;
  • How does this approach differ from configuring lid off/on in /etc/systemd/logind.conf? Do we need to configure both, or are they mutually exclusive? – modulitos Jan 1 '16 at 8:43
0

Follow this: https://wiki.archlinux.org/index.php/Pacman

Being new to Linux and going directly to Arch is not a good idea. Take a look at Fedora/Ubuntu or Debian.

Ps: You need to generate the PGP keys for arch linux so you can add them.

  • But I was under the impression that installing (or updating pacman) did that automatically... – mtahmed Sep 4 '12 at 18:53
  • thanks, this helped getting xscreensaver. but that script still isn't running anything on lid close – Jack Stewart Sep 4 '12 at 19:04
  • 3
    @mtahmed Actually it depends on the installation you are using. Last time I installed using the new Arch version, I didn't need to do anything. If you do, you usually need; pacman-key --init ; pacman-key --populate archlinux. JackStewart: I remember having the same problem with XFCE4. I The only way for me to close the lid was telling XFCE4 to suspend and not hibernate. Maybe a hint, perhaps you tried laptop-tools from the repo? wiki.archlinux.org/index.php/Laptop_Mode_Tools – user22921 Sep 11 '12 at 10:14
0

I understand this question is a little old, now the easiest way to do this is with systemd.

Use systemd-logind for this. see man logind.conf.

With HandleLidSwitch option you can tell it what you want it to do when lid closes.

HandleLidSwitch=suspend

The options can be one of ,

  • ignore
  • poweroff
  • reboot
  • halt
  • kexec
  • suspend
  • hibernate
  • hybrid-sleep
  • lock

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.