How can I make GNOME 3 use
pm-suspend-hybrid instead of
pm-suspend when closing the lid or using suspend from the menu?
Be sure it works
First of all you need to be sure
pm-suspend-hybrid works on your computer. Type
in console and notice if it works as expected.
It is more the hack than a solution. But it works for me.
Execute the following commands in the console:
ls -l /usr/sbin/pm-suspend # it should be symlink to /usr/lib/pm-utils/bin/pm-action sudo rm /usr/sbin/pm-suspend # just remove this link sudo editor /usr/sbin/pm-suspend # create new file instead of symlink
Contents of the new
#!/bin/bash pm-suspend-hybrid # notice that you need to execute "pm-suspend-hybrid" # just changing symlink is not enough
Than give execution rights to this new script:
sudo chmod +x /usr/sbin/pm-suspend
- If your distribution does not use
sudocommand you need to be root to execute these commands.
- It is possible that
pm-suspendis located at another path on your system. Just type
whereis pm-suspendto find correct path.
- You may use any text editor of your choice instead of
editorif you want or if your distribution does not have this wrapper.
1Thank you for this detailed answer! I had the same idea a while ago but didn't bother trying it. Jun 11, 2012 at 1:02
I have a workflow without having to create a file, without deleting the original file and that works in one command. Paste this in a terminal if you already know that your machine support hybrid suspension:
sudo mv /usr/sbin/pm-suspend /usr/sbin/pm-suspend_traditional && sudo ln -sf /usr/sbin/pm-suspend-hybrid /usr/sbin/pm-suspend
With the command above you will be enabling the hybrid suspension by default on your system. It is totally safe. Restoring The original config can restored by entering this command:
sudo mv /usr/sbin/pm-suspend_traditional /usr/sbin/pm-suspend
Step by step explanation
First you should check if your machine support H-S.
check if HS is supported by pasting this in a terminal (source webupd8 http://goo.gl/kjISbj):
sudo pm-is-supported --suspend-hybrid && echo "hybrid suspend is supported" || echo "your system doesn't support hybrid suspend"
The output of this command is a message that says if your machine does support or not hybrid-suspension.
Make a backup
sudo mv /usr/sbin/pm-suspend /usr/sbin/pm-suspend_traditional
Make a link instead of a script:
sudo ln -sf /usr/sbin/pm-suspend-hybrid /usr/sbin/pm-suspend
Note: The re-hack just combines steps 2 and 3.
The advantages of this method compared with Lig's one are:
- avoid the need to (and you shouldn't) delete the original
- it creates a backup that allows you to restore the previous setting
- avoid the need of editing a new file, instead just link the original existent one with a symbolic link (
Please note: Answers can be sorted in a number of ways, so "the response above" really doesn't have any context here.– aleJan 9, 2014 at 14:39
Yeah, I noticed, that's why I put the author's name. What would be the proper way to cite it? Jan 10, 2014 at 11:15
The author name is okay. Not so useful when there's a lot of answers, though, so I would link to the answer referenced.– aleJan 10, 2014 at 12:53
Does not works, as @lig says, it is required that the script is called with the right name (pm-suspend-hybrid) so that the rigth action is performed. symlink is not enough. Feb 2, 2015 at 21:25
gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action "hibernate"and
gsettings get org.gnome.settings-daemon.plugins.power lid-close-battery-action "hibernate"you can also use "blank" or "shutdown" as the action