If you set the screen to lock after a certain period in XFCE, and the computer to suspend after a further period, you may encounter the above message when you come back to the computer: the screen has blanked but the computer hasn't suspended. The message is (for search engines):
Authentication is required to suspend the sytem. Action: org.freedesktop.login1.suspend. Vendor: The systemd Project.
The XFCE settings for this are:
Power Manager > System > System Power Saving > Suspend / When inactive for 30 minutes.
and
Power Manager > Display > Display Power Management > Blank after 15 minutes
and
Power Manager > Security > Light Locker > Automatically lock the session / When the screensaver is activated
This does not happen if the screen is set to blank but not lock, and to lock when the system suspends, with the settings:
Power Manager > Security > Light Locker > Automatically lock the session / Never
and
Power Manager > Security > Light Locker > Lock screen when system is going to sleep
A solution (if you would like to lock the screen when it blanks and have the system suspend at a later time) is
Add a file
/etc/polkit-1/rules.d/85-suspend.rules
(NB this involves creating a directory and a file in it - read to the end if you need instructions for this.)
with:
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.suspend" &&
subject.isInGroup("<your user name>")) {
return polkit.Result.YES;
}
});
And in Terminal, type:
# chmod 755 /etc/polkit-1/rules.d
# chmod 644 /etc/polkit-1/rules.d/85-suspend.rules
Then reboot.
This is a slightly modified version of a solution posted by mja at askubuntu.com. Why? Because the solution there uses:
subject.isInGroup("users")) {
But the group "users" does not exist by default, and its use in not recommended according to the Arch Wiki. Using my user name (which is also a group by default) worked for me.
So if your user name is fred, use
subject.isInGroup("fred")) {
Note that mja also points out that the first solution on the Ask Ubuntu site involving the
org.freedesktop.login1.policy
file is not recommended according to the Arch Wiki site because the file could be overwritten at a later date.
The Debian Wiki has a solution to the same problem which involves the rules file and the policy file, but does not mention the need to create the group users.
For me, using the rules file was enough to solve the issues.
The Debian Wiki does give instructions for creating the rules.d directory:
# mkdir /etc/polkit-1/rules.d
so check it out if the process is unclear.
No comments:
Post a Comment