How do I suspend my computer from the lockscreen in Gnome 3 (Fedora 20)? Sometimes I accidentally press the lock key, which is right next to the suspend key. Once it's locked, it no longer listens to the suspend key or power button. I am trying to avoid needing to type in my password just to suspend.


Someone pointed me to the file /etc/systemd/logind.conf. I was able to set parms that allowed the suspend key to work in any situation regardless what the system requests. Here is an example of my settings.


For some reason a restart was not applying the changes, so I had to run the following command:

sudo systemctl restart systemd-logind

Was looking for similar option.. The first answer's settings did not unfortunately work for me on Ubuntu Mate 16.04.. Maybe it is because when Mate 16.04 was released, systemd wasn't fully embraced.

However I came up with following solution of hijacking the /etc/acpi/powerbtn.sh with mate-screensaver-command:

sudo -u $USERNAME DISPLAY=:0 mate-screensaver-command -l && systemctl suspend

Thus the beginning of my /etc/acpi/powerbtn.sh:

# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.

#shutdown -h now
#loginctl lock-session && systemctl suspend

sudo -u $USERNAME DISPLAY=:0 mate-screensaver-command -l

Please note that this requires replacing the $USERNAME for your own. Personally I would hard code the username on single-user machines. Please make your own choice regarding how you want to determine which users can run the command. Maybe use something like $LOGNAME (a default env on Ubuntu Mate when running 'printenv' )

sudo -u $LOGNAME DISPLAY=:0 mate-screensaver-command -l

I know this doesn't answer the question for enabling the sleep button, and replaces shutdown button functionality, but for me it works perfectly. I'd figure it would be simple enough to modify the /etc/acpi/powerbtn.sh file to take in to account if the user is in the lock screen or logged in; thus making the shutdown button work normally when logged in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.