LinuxQuestions.org
Review your favorite Linux distribution.
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
Posts: 10

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: 4864Reputation: 4864Reputation: 4864Reputation: 4864Reputation: 4864Reputation: 4864Reputation: 4864Reputation: 4864Reputation: 4864Reputation: 4864Reputation: 4864
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.
 
Old 02-03-2015, 06:08 PM   #4
lzhiren
LQ Newbie
 
Registered: Oct 2014
Posts: 10

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: Slackware-current
Posts: 5,277

Rep: Reputation: 1919Reputation: 1919Reputation: 1919Reputation: 1919Reputation: 1919Reputation: 1919Reputation: 1919Reputation: 1919Reputation: 1919Reputation: 1919Reputation: 1919
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:48 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration