• Dell XPS 13 - Hibernate on Low Battery


    Hello,

    I am trying to get hibernate to work correctly on my Dell XPS 13 (9350 model). I want the computer to automagically hibernate when the battery reaches a critical level (1-5% battery life).

    I read the following wiki here that talks about how to set this up, linked below:
    https://wiki.archlinux.org/index.php/Laptop#hibernate_on_low_battery_level

    However, neither of those utilities running in terminal give me anything on my XPS 13. Is there something I can do so it auto-hibernates itself when it reaches 1-2% of battery life?

    Thanks!

  • i have the same problem here with i3 and my t60 thinkpad…

  • @a4orce84 said in Dell XPS 13 - Hibernate on Low Battery:

    when it reaches 1-2% of battery

    will better to shut down then ;)

  • haha that was a typo! 1-5%, I’ll even take 1-10% if that is any easier. I tried following the Arch Wiki, and I can see the battery is discharging properly…maybe I need to do some reading on systemd magic.

  • One of reasons I often use Openbox on my main machine, even if it’s powerful enough to run any other DE: in now way can I make GNOME notify me and suspend on low battery. Since the battery is quite old, it dies suddenly, especially while I’m doing something important. On Openbox, with Tint2 installed, I make use of the obhud script, which warns, and suspends the machine if no action taken.

  • Well @joekamprad helped me with the ability to hibernate after 2 hours if the machine is in suspend state. Link to other thread with solution here:
    https://forum.antergos.com/topic/6810/hibernate-after-extended-sleep

    This still works without issue. Gnome DE (under wayland) tells me that my battery is low, at least when it hits 10% (and under). Screenshot below:
    https://imgur.com/a/uxANGqC

    It just doesn’t automagically go into hibernate like it should…

    Any help from anyone would be greatly appreciated. Thanks!

  • If it helps, I know Deepin now has that feature by default :) . As for other DEs, you could probably use something like this: (please note that I have NOT tested this script - it’s only an idea. Thanks!)

    upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "percentage" | awk '{print $2}'
    
    if [ "$?" == 10% ]; then
    echo "MY_PASSWORD" | sudo -S systemctl suspend
    else
    RUN/THIS/SCRIPT/AGAIN/REPEATEDLY.sh
    fi
    

    Basically, what this does is output your percentage in the first command, and then the if statement just uses the above output and compares it to 10%. If it outputs something else, then in just runs the script again in the background until it does output 10%. If it happens to output 10%, then it suspends without you even needing to authenticate it- it just does so automatically. Obviously this can pose a security threat as your sudo password is printed in this script. So perhaps you might prefer a different suspend command? I am not aware of the full spectrum of options out there, I only came up with this off the top of my head.

    So good luck and hope this works for you!

  • Any luck here?

  • Hey @Keegan,

    @joekamprad and I have been working on this trying to get a cron solution to work. I think we are both stuck atm in terms of testing and getting things working though.

  • @piotr said in Dell XPS 13 - Hibernate on Low Battery:

    One of reasons I often use Openbox on my main machine, even if it’s powerful enough to run any other DE: in now way can I make GNOME notify me and suspend on low battery. Since the battery is quite old, it dies suddenly, especially while I’m doing something important. On Openbox, with Tint2 installed, I make use of the obhud script, which warns, and suspends the machine if no action taken.

    Exactly I do the same thing for years, totally agree.
    With OpenBox there are never problems with anything. Less resources for more than a lot of ram, it’s never bad.☺ 👍

  • I guess I’m surprised no one in the Arch community would want a similar feature…

  • @a4orce84 I would like to see a system running perfectly on a mobile device… and give all the features you realy need at every point.

  • @Keegan,

    If I wanted to try out your script under Gnome DE, where would I create that script? I believe @joekamprad was trying to do this via systemd, but it was not working out like he hoped.

  • Simply stick the script in /usr/bin and then create a .desktop file in /etc/xdg/autostart/. Something that looks like this:

    [Desktop Entry]
    Type=Application
    Name=Sleep.. I SAID SLEEP!!!!! (or whatever you want to call it. It really does not matter at all)
    Exec=SCRIPT_NAME.sh
    

    That way, the script is autostarted the moment you log in :) .

    Hope this can help you out! If it works, I think I’ll turn this into a program… oooh… I can already feel my mind’s gears turning here 🤣

dell28 xps25 hibernate15 low8 Posts 14Views 704
Bloom Email Optin Plugin

Looks like your connection to Antergos Community Forum was lost, please wait while we try to reconnect.