小智 19
在命令行中运行:
locate -b org.freedesktop.login1.policy
Run Code Online (Sandbox Code Playgroud)
找到的文件是/usr/share/polkit-1/actions/org.freedesktop.login1.policy
.
在文件中,近线
<action id="org.freedesktop.login1.suspend">
Run Code Online (Sandbox Code Playgroud)
检查这些:
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
Run Code Online (Sandbox Code Playgroud)(来源)
mja*_*mja 11
将自己添加到users
分组依据
sudo usermod -aG users "$USER"
Run Code Online (Sandbox Code Playgroud)
完成以下步骤后,您需要重新启动计算机。
您可以通过以下方式检查 Polkit 的版本: pkaction --version
如果 PolKit 版本 < 0.106,则没有 .rules
文件,只有旧
文件.pkla
和.conf
文件,因为那些 Polkit 版本没有 Javascript 解释器。
只需添加一个文件/etc/polkit-1/rules.d/85-suspend.rules
:
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.suspend" &&
subject.isInGroup("users")) {
return polkit.Result.YES;
}
});
Run Code Online (Sandbox Code Playgroud)
在终端中,输入:
sudo chmod 755 /etc/polkit-1/rules.d
sudo chmod 644 /etc/polkit-1/rules.d/85-suspend.rules
Run Code Online (Sandbox Code Playgroud)
在这种情况下,添加一个文件/var/lib/polkit-1/localauthority/50-local.d/50-enable-suspend-on-lockscreen.pkla
:
[Allow suspending in lockscreen]
Identity=unix-group:users
Action=org.freedesktop.login1.suspend
ResultAny=yes
ResultInactive=yes
ResultActive=yes
Run Code Online (Sandbox Code Playgroud)
在 bash 中,输入:
sudo chmod 644 /var/lib/polkit-1/localauthority/50-local.d/50-enable-suspend-on-lockscreen.pkla
Run Code Online (Sandbox Code Playgroud)
在 XFCE 电源管理器中:
在Security
选项卡下:
Automatically lock the session
为从不Lock the screen when the system is going for sleep
Display
选项卡下,15 分钟后黑屏。要禁用的设置Sleep
和Switch off
时间(变灰)。System
选项卡下,将系统睡眠模式设置Suspend
为半小时后。参考: