
答案1
我最近遇到了同样的问题,因此我按照以下步骤解决了它。
- 创建自定义 systemd 服务以在挂起时锁定屏幕:
sudo nano /etc/systemd/system/lock.service
- 在文件中添加以下内容:
[Unit]
Description=Lock the screen on suspend
[Service]
Type=oneshot
User=root
ExecStart=/bin/loginctl lock-sessions
[Install]
WantedBy=suspend.target
- 保存并关闭文件,然后启用服务:
sudo systemctl daemon-reload
sudo systemctl enable lock.service