On 28.01.14 at 13:48, Patrick Burroughs (Celti) wrote:
On Tue, Jan 28, 2014 at 8:51 AM, Daniel Landau <daniel.landau@iki.fi> wrote:
On Mon, Jan 27, 2014 at 10:49 PM, Patrick Burroughs (Celti) <celticmadman@gmail.com> wrote: And the udev rule works! Now I can completely do away with laptop-mode-tools.
For the curious, I used: SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="5", RUN+="/usr/bin/systemctl hybrid-sleep"
This should work for any laptop that emits battery uevents at a reasonable rate; mine didn't seem to at first, but started sending one per 1% drop after it dropped below 15% or so, so if you want to test it you may be waiting a while.
That's cool! Do you think this would fit somewhere in the Wiki or as an AUR package?
A wiki article seems best, so that people can adjust the type of sleep and percentage chance to best suit their laptop.
It's already there: https://wiki.archlinux.org/index.php/Laptop#Udev_events You should also be aware of this caveat: https://wiki.archlinux.org/index.php/Talk:Laptop#RUN.2B.3D.22.3Ccommand.3E.2...
Are you sure you want hybrid-sleep instead of plain hibernate: both will save your state to disk but with hybrid-sleep you run the risk of running your battery all the way down, which supposedly isn't healthy for the battery (http://www.pcworld.com/article/191574/long_live_your_laptop_battery.html).
There is a small danger of that, but my laptop uses little enough power when suspended that that 5% charge will give me hours to plug it back in. The hybrid sleep is just a final failsafe and the hibernate part should never actually be needed.
Regards, ~Celti