LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-03-2015, 01:23 AM   #1
lzhiren
LQ Newbie
 
Registered: Oct 2014
Distribution: Slackware
Posts: 14

Rep: Reputation: Disabled
Laptop lid close suspend with i3


Hello, I am currently using Slackware 14.1 with i3 as my window manager. I cannot seem to get my laptop to suspend when I close the lid.
I did some googling and it seems that I need to create an event in the acpi script file. I followed the solutions I found online but they didn't work.
So my question is, how do I get my laptop to suspend when I close the lid using acpi events in i3?
 
Old 02-03-2015, 09:08 AM   #2
kontranik
LQ Newbie
 
Registered: Jan 2015
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by lzhiren View Post
So my question is, how do I get my laptop to suspend when I close the lid using acpi events in i3?
you must edit this file, delete everything else from:

/etc/acpi/actions/lm_lid.sh

Code:
#!/bin/sh
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
   pm-suspend
   exit
fi
sorry for my bad english
 
Old 02-03-2015, 09:18 AM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Alternatively, if you prefer a GUI solution, you can use xfce4-power-manager together with i3, which let's you configure the wanted behavior in its setting dialog.
 
1 members found this post helpful.
Old 02-03-2015, 06:08 PM   #4
lzhiren
LQ Newbie
 
Registered: Oct 2014
Distribution: Slackware
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thanks for the help, but these solutions did not work.

When I close the lid, nothing happens. Also I tried adding xfce4-power-manager to .xinitrc, but when I try to close the lid it tells me "power manager not authorized." However if I run xfce4-power-manger from dmenu, it works. But I want a permanent fix and not just something that I have to start manually at every login.

If it helps here are my acpi files.

/etc/acpi/events/lid
Code:
event=button/lid 
action=/etc/acpi/actions/lid.sh %e
/etc/acpi/actions/lid.sh
Code:
#!/bin/sh
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
           pm-suspend
           exit
fi
 
Old 02-04-2015, 01:35 AM   #5
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
This is what I have in my /etc/acpi/acpi_handler.sh to hibernate when I close the lid
Code:
IFS=${IFS}/
set $@

case "$1" in
  button)
    case "$2" in
      power) /sbin/init 0
         ;;
      lid) grep -q closed /proc/acpi/button/lid/LID0/state && /usr/sbin/pm-hibernate
         ;;
      *) logger "ACPI action $2 is not defined"
         ;;
    esac
    ;;
  *)
    logger "ACPI group $1 / action $2 is not defined"
    ;;
esac
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] 14.0: What is the canonical way to suspend on lid-close padeen Slackware 5 10-16-2012 10:29 AM
No suspend on lid close AllanP Linux - Laptop and Netbook 26 05-19-2012 12:38 PM
LXer: Ready for Gnome 3.2? no more suspend on laptop lid close LXer Syndicated Linux News 0 09-16-2011 02:41 AM
disable suspend when I close the laptop lid lindylex Debian 5 04-14-2009 08:53 AM
Suspend to Disk problem when I close my laptop lid xbaez Mandriva 0 06-23-2004 08:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration