That was very useful. As an additional note...
On my Dell XPS 13 I also had to check the contents of /sys/power/mem_sleep as the default (between brackets) was s2idle and it indicated that also 'deep' or suspend to RAM was possible, saving even more power.
I followed the instructions of https://www.kernel.org/doc/html/v4.18/a … tates.html to make 'deep' the default by adding it to /etc/default/grub e.g.
GRUB_CMDLINE_LINUX_DEFAULT="quiet mem_sleep_default=deep"
and ran 'update-grub' afterwards.
]]>I have a solution to the lid suspend problem that works without pm-utils
/etc/acpi/events/lid:
event=button/lid
action=/etc/acpi/lid
/etc/acpi/lid (must be executable):
#!/bin/sh
grep -q close /proc/acpi/button/lid/LID/state && echo mem > /sys/power/state
Then reload the configuration:
# pkill -hup acpid
(This presumes that acpid is already installed and started.)
]]>/etc/pm/sleep.d/00lock
#!/bin/sh
# Specify the display for acpi
export DISPLAY=:0
# Run a specified program as user
run(){
su -c "$1" omega
}
# Run programs for pm-utils
case $1 in
suspend|hibernate)
run /usr/bin/slock &
;;
resume|thaw)
;;
esac
/etc/acpi/lid.sh
#!/bin/sh
if [ "$3" = "close" ]; then
/usr/sbin/pm-suspend
fi
acpi-script hack
That's such a beautifully mis-informed notion!
It reads as a praise to the layers and layers of code in between the person and the action, simply to make a drawing of it, so it can be operated without articulated thought.
Other than that, I have nothing
]]>I confirm all problems still persist in xfce on Devuan:
- no lid-based actions in xfce (only via acpi-script hack -> but this still doesn't trigger anything power-related in the xfce gui)
- no battery actions -> this is particularly annoying as you don't get warning when you run out of battery or also don't see if you are charging or not
- strangly: volume and display buttons work
- power button works sometimes (usually not)I tried diffrent versions of xfce4-power-manager, upower, acpid - even from ceres - all don't work.
I don't actually understand why all this doesn't work? Anybody has a better idea what is missing in xfce4-power-manager?
All this does work on voidlinux (I haven't tried artix yet).
It is disappointing, the Mate power manager is even worse.
You got all that to work on voidlinux? Maybe doublecheck packagelists and see if there's something extra that's helping it work right in the other distro? Version used in voidlinux?
]]>I tried diffrent versions of xfce4-power-manager, upower, acpid - even from ceres - all don't work.
I don't actually understand why all this doesn't work? Anybody has a better idea what is missing in xfce4-power-manager?
All this does work on voidlinux (I haven't tried artix yet).
And doesn't look like there's a way to mod the XFCE power manager to run the proper commands, it offers close/lid options but they don't work. This is what's really needed IMO, but I guess the power manager would need to be modded and re-compiled.
]]>if [ "$3" = "close" ] ; then
DISPLAY=:0 su -c "xtrlock -b" ralph &
/usr/bin/obsession-exit -s
fi
Note also that (afaik) the lid button script is run by acpid as root and not "the DE user", so a sudo isn't needed, but some way to ensure GUI access is. The added command line above includes the two parts of making the locking program (xtrlock) have the right $DISPLAY set up, and (via su) be the right user (for my laptop).
]]>#!/bin/bash
if [ "$3" = "close" ] ; then
/usr/bin/obsession-exit -s
fi
I imagine you can just add " && [lock program or command] " to that command and it will lock as well?
]]>I was just posting to let everyone know that I did a fresh install on a Thinkpad T440 with xfce4 and it would not sleep on lid close. Using this thread and some searching I got it to work.
First was running visudo as root to allow my user to run pm-suspend
# username suspend permission username ALL=NOPASSWD: /usr/sbin/pm-suspend
then I created an acpi event by creating /etc/acpi/events/lid
event=button/lid action=/etc/acpi/actions/lid_suspend.sh %e
(make sure to make it executable with "chmod +x lid")
Finally I created the folder and file /etc/acpi/actions/lid_suspend.sh
#!/bin/bash if [ "$3" = "close" ] ; then /usr/sbin/pm-suspend fi
(chmod +x lid_suspend)
I did "service restart acpid" for good luck and it worked!
Thank you everyone for your help!
First was running visudo as root to allow my user to run pm-suspend
# username suspend permission
username ALL=NOPASSWD: /usr/sbin/pm-suspend
then I created an acpi event by creating /etc/acpi/events/lid
event=button/lid
action=/etc/acpi/actions/lid_suspend.sh %e
(make sure to make it executable with "chmod +x lid")
Finally I created the folder and file /etc/acpi/actions/lid_suspend.sh
#!/bin/bash
if [ "$3" = "close" ] ; then
/usr/sbin/pm-suspend
fi
(chmod +x lid_suspend)
I did "service acpid restart" as root for good luck and it worked!
Thank you everyone for your help!
]]>event=button[ /]lid
action=/etc/acpi/lidbtn-suspend.sh %e
and my script is named accordingly.
Especially the %e on the invoked command is important; it gets replaced with the triggering input line from acpid
button/lid LID close
or
button/lid LID open
or
any other acpid event lines
and it thus gives three arguments to the script, the third of which is the lid action. The script I suggested peeps a those, and requires the third to be close in order to suspend.
Note that your alternative pattern lines are all ok, I think, in the sense of matching the event line. An observation though (irrelevant as it is), since the pattern is a regular expression, an ending of d* says that there must be zero or more d at that match point. I guess you intended it to be d.* (saying "a d followed by whatever"). But "followed by whatever" is implied unless there is a $ at the end.
Hopefully that can make it work for you.
]]>InsertUsernameHere@HostMachine:~$ /usr/sbin/pm-suspend
This utility may only be run by the root user.
Only typing suspend or clicking Log Out and manually selecting Suspend works, and intermittently at that! As I write this now, typing suspend just hangs in the terminal. Logging into a root terminal, I found pm-suspend command to work flawlessly regardless. This has me stymied.
Perhaps adding pm-suspend to my sudoers.d file and prefixing the command with sudo might work? My other thought was with changing lm_lid from this:
event=button/lid.*
action=/etc/acpi/lid.sh
To this:
event=button[ /]lid.*
action=/etc/acpi/lid.sh
Anyone who can help to solve this will be greatly lauded by the community, especially me. I'm going to keep working on this when I have time; until then, I encourage others to post their suggestions and potential solutions for the community.
P.S. Thanks for weighing in Green Jeans, its nice to know others are experiencing the same frustrations; the more prominent an issue this becomes, the greater attention that will be garnered from developers like you, thank you!
]]>