Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Desktop Environments
  • Search

A crucial, yet apparently missing feature for laptops...

Problems with GUI applications? Questions about X, KDE, Gnome, Fluxbox, etc.? Come on in. NOTE: For multimedia, go up one forum
Post Reply
Advanced search
6 posts • Page 1 of 1
Author
Message
avieth
Veteran
Veteran
User avatar
Posts: 1945
Joined: Fri Sep 17, 2004 3:48 pm
Location: Canada

A crucial, yet apparently missing feature for laptops...

  • Quote

Post by avieth » Mon Jul 12, 2010 3:52 am

I'm a laptop user, and I like for my laptop to sleep when the lid is closed... most of the time.

Sometimes, however, I like to close the lid and have the computer not sleep, like when I just want to quickly move it.

The solution: a switch that will inhibit any attempt by the machine to suspend/hibernate/blank screen.

For some reason I can't find this feature. There seems to be plenty of support for inhibiting 'automatic' sleep, but that support doesn't extend to actions like closing the lid.

I put this thread under Desktop Environments because I've always used a graphical power management interface. Right now I'm using Gnome, and gnome-power-manager's inhibit applet is garbage, but it's the closest thing to what I want.

Any ideas? Does such a thing exist?
Top
DaggyStyle
Watchman
Watchman
User avatar
Posts: 5969
Joined: Wed Mar 22, 2006 6:57 am

  • Quote

Post by DaggyStyle » Mon Jul 12, 2010 6:06 am

you can define a event per power scheme, on my laptop, when it is plugged, nothing happens when I close the lid (power goes off after a minute) but when I'm on battery, closing the lid results in suspend to ram.
also, don't know about gnome, but there are buttons in kde's powerdevil which cause hibernate and suspend to ram, you can assign default keystrokes for them.

btw, afaik, no other os can do that, an os cannot guess when you want to lock the screen or go to hibernate on it self.
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Top
dmpogo
Advocate
Advocate
Posts: 3713
Joined: Thu Sep 02, 2004 9:21 pm
Location: Canada

  • Quote

Post by dmpogo » Mon Jul 12, 2010 6:42 am

I have setup my laptop to both hibernate and sleep when lid is closed, but do it only after some delay (20 sec or so) and if lid opens before that, cancel everything.

This way quick lid openning does nothing, more prolonged avoids reboot, and if I forget and battery runs out I have hibernated image to start from.
Top
albright
Advocate
Advocate
User avatar
Posts: 2588
Joined: Sun Nov 16, 2003 6:36 pm
Location: Near Toronto

  • Quote

Post by albright » Mon Jul 12, 2010 12:22 pm

I have setup my laptop to both hibernate and sleep when lid is closed, but do it only after some delay (20 sec or so) and if lid opens before that, cancel everything.
very clever - is this setup via the acpi default.sh script? Some more details would be
appreciated

thanks
.... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme)
Top
avieth
Veteran
Veteran
User avatar
Posts: 1945
Joined: Fri Sep 17, 2004 3:48 pm
Location: Canada

  • Quote

Post by avieth » Mon Jul 12, 2010 8:44 pm

albright wrote:
I have setup my laptop to both hibernate and sleep when lid is closed, but do it only after some delay (20 sec or so) and if lid opens before that, cancel everything.
very clever - is this setup via the acpi default.sh script? Some more details would be
appreciated

thanks
Seconded. Sounds like a really good solution.
Top
dmpogo
Advocate
Advocate
Posts: 3713
Joined: Thu Sep 02, 2004 9:21 pm
Location: Canada

  • Quote

Post by dmpogo » Tue Jul 13, 2010 12:56 am

My scripts is a combination of acpid script, tuxonice and hibernate-scripts. Changes are really minor

My default.sh has

Code: Select all

case "$group" in
        button)
                case $action in
                        power)
                                /sbin/shutdown -h -t 5 now
                                ;;
                        #       xset dpms force off
                        lid)
                                date >> /var/log/lid
                                echo $id >> /var/log/lid
                                echo $value >> /var/log/lid
                                cat /proc/acpi/button/lid/LID/state >> /var/log/lid
                                /etc/acpi/lidbtn.sh
                                ;;

                        *)      log_unhandled $* ;;
                esac
                ;;
where /etc/acpi/lidbtn.sh is

Code: Select all

#!/bin/bash

lid_state=/proc/acpi/button/lid/LID/state

test -e $lid_state || exit 0

if grep -q closed $lid_state ; then
#Often, we shutdown or hibernate and then immediately close lid.
#Try to sleep to let these processes finish
   sleep 30s
# Lid could have been open back during this wait
   if grep -q closed $lid_state ; then
      logger "lid closed -> suspending"
      /usr/sbin/hibernate-s2both
   fi
else
   logger "lid opened -> resuming"
fi
It uses a bit modified script from hibernate-scripts, I have a symlink /usr/sbin/hibernate-s2both

Code: Select all

/usr/sbin/hibernate-s2both -> /usr/sbin/hibernate
and use the property of hibernate scripts, that if you have a symlink with a "suffix", hibernate searches for a configuration file "suffix.conf" in /etc/hibernate directory. In my case it is "s2both.conf". This conf file is just a copy of tuxonice.conf, with one difference

Code: Select all


## Powerdown method - 3 for suspend-to-RAM, 4 for ACPI S4 sleep, 5 for poweroff
PowerdownMethod 3
tuxonice always writes and image to disk, as for hibernation, and now I instruct it after doing it not to hibernate, but suspend-to-RAM



One thing is, script relies on /proc interface which acpid starts to abandon. For now it still seems to work, however, deperetiated proc entries and directories are enabled in my kernel.
Top
Post Reply

6 posts • Page 1 of 1

Return to “Desktop Environments”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic