Had*_*des 4 lock-screen power-management user-management
我试图让我的笔记本电脑在盖子关闭的情况下继续运行。
到目前为止我所做的是:
/etc/systemd/logind.conf
添加HandleLidSwitch=ignore
停靠和普通模式。这根本没有用。 /etc/UPower/UPower.conf
集中IgnoreLid=true
这有效,但现在我的 TeamViewer 会话关闭并且屏幕被锁定,所以我仍然无法实际使用笔记本电脑。
您可以使用一些gsettings:
在交流线路上处理
gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action 'nothing'
Run Code Online (Sandbox Code Playgroud)
当盖子关闭并且笔记本电脑插入交流电时,这将禁用任何操作。
简单地撤消:
gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
Run Code Online (Sandbox Code Playgroud)
可能的设置值而不是挂起是:
“空白”、“暂停”、“关机”、“休眠”、“交互”、“无”、“注销”
使用电池时的处理
gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action 'nothing'
Run Code Online (Sandbox Code Playgroud)插入外接显示器时的处理
gsettings set org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor 'nothing'
Run Code Online (Sandbox Code Playgroud)如果您更喜欢基于 gui 的解决方案,则必须安装
sudo apt install dconf-editor
Run Code Online (Sandbox Code Playgroud)
调用
dconf-editor&
Run Code Online (Sandbox Code Playgroud)
或通过搜索程序破折号。
转到上图第一行所示的架构,并进行设置:
在 Ubuntu 19.10 上,这些gsettings set org.gnome.settings-daemon.plugins.power lid-close-*
操作似乎不再起作用。
编辑文件/etc/systemd/logind.conf
并sudo
更改行
#HandleLidSwitch=.....
Run Code Online (Sandbox Code Playgroud)
到
HandleLidSwitch=lock
Run Code Online (Sandbox Code Playgroud)
并重新启动您的系统。
该文件/etc/systemd/logind.conf
控制登录应如何处理系统电源和睡眠键以及盖子开关以触发系统断电或挂起等操作。可以是
“忽略”、“断电”、“重新启动”、“停止”、“kexec”、“挂起”、“休眠”、“混合睡眠”、“挂起然后休眠”和“锁定”之一。对于这些设置:
HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=,
HandleLidSwitchExternalPower=, HandleLidSwitchDocked=
Run Code Online (Sandbox Code Playgroud)
参考: