该笔记将记录:在 GNOME 3 中,与锁屏有关的内容,以及常见问题的解决方法;
应用
常亮 | 当锁屏后,保持屏幕常亮(不黑屏)
Unblank screen saver by sun_wang
官网:https://extensions.gnome.org/extension/1414/unblank/
文档:
仓库:https://github.com/sunwxg/gnome-shell-extension-unblank
禁用 | 避免锁屏,无法锁屏,……
Disabling the GNOME automatic screen locking :: Fedora Docs
ubuntu – How to disable entirely the GNOME lock screen? – Stack Overflow
gnome – Screen lock not working in Ubuntu 22.04 – Ask Ubuntu
Ubuntu 20.04 TLS, Ubuntu 22.04 LTS
问题描述:
在虚拟机中,我们运行 Ubuntu 20.04 TLS 发行版,但是我们并不希望锁屏。
解决方案:
- 禁用自动锁屏:Settings ⇒ Privacy ⇒ Screen Lock ⇒ Automatic Screen Lock ⇒ Off,把能够关闭的全部关闭;
- 禁用锁屏功能:shell> gsettings set org.gnome.desktop.lockdown disable-lock-screen true
注 1:当禁用锁屏功能后,自然就无法进行锁屏,需要重新配置 disable-lock-screen false 参数;
关闭黑屏(Blanking Screen)
suspend – Screen keeps turning off on Ubuntu 17.04 after 30 seconds of inactivity – Ask Ubuntu
Display Power Management Signaling – ArchWiki
在 Ubuntu 21.04 中,在 Power 中,虽然我们关闭 Blank Screen 设置,但是 30s 之后还是会自动黑屏。
我们尝试过这些方法,但是都未生效:
1)gnome – Screen turning off when idle even with power settings disabled – Ask Ubuntu
2)Set screen blanking time
3)Ubuntu 18.04 will not stop blanking screen – Ask Ubuntu
根据提示(How to stop screen going black after 10 min)该问题需要通过 xset 关闭 DPMS 设置:
xset -dpms
如果希望开机自动生效(持久化配置),需要增加:
# /etc/X11/xorg.conf.d/10-monitor.conf
Section "Extensions"
Option "DPMS" "Disable"
EndSection
为了减小对系统的修改,我们通过如下方式进行持久化配置:
echo "xset -dpms" >> ~/.xprofile # 在 Ubuntu 21.04 中 echo "xset -dpms" >> ~/.xinitrc # 在 Ubuntu 21.04 中,未生效
改进
Unable to lock
问题描述:桌面提示 Unable to lock, Lock was blocked by an application 消息
原因分析
调高日志等级或许会看到原因(我们没有进一步追踪):
# journalctl -n 100 ... Mar 12 21:59:53 laptop.dc.d3rm.org gnome-shell[1890]: error: Unable to lock: Lock was blocked by an application Mar 12 22:03:48 laptop.dc.d3rm.org update-notifier.desktop[931690]: /usr/lib/python3/dist-packages/aptdaemon/gtk3widgets.py:47: PyGIWarning: Gdk was imported without specifying a version first. Use gi.require_ver> Mar 12 22:03:48 laptop.dc.d3rm.org update-notifier.desktop[931690]: from gi.repository import Gdk Mar 12 22:03:48 laptop.dc.d3rm.org update-notifier.desktop[931690]: /usr/lib/python3/dist-packages/aptdaemon/gtk3widgets.py:48: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_ver> Mar 12 22:03:48 laptop.dc.d3rm.org update-notifier.desktop[931690]: from gi.repository import Gtk Mar 12 22:06:17 laptop.dc.d3rm.org systemd[1651]: Started Application launched by gnome-shell. ...
解决方案
针对 VirtualBox 程序,File ⇒ Preferences… ⇒ Input ⇒ Auth Capture Keyboard,取消选择;
经过几小时的观察,现在已能够自动锁屏;
但是,这样 Guest 就无法获取 Alt+Tab 快捷键组合……我们最后还是决定忍受这个提示(除非彻底关闭通知);