保持笔记本电脑运行时关闭盖子

我试图让我的笔记本电脑在关闭盖子的情况下运行。

到目前为止我所做的是:

  1. 在文件/etc/systemd/logind.conf ,为停靠模式和普通模式添加HandleLidSwitch=ignore 。 这根本不起作用。
  2. 在文件/etc/UPower/UPower.conf设置IgnoreLid=true

这有效,但现在我的TeamViewer会话关闭,屏幕被锁定,所以我仍然无法使用笔记本电脑。

基于命令行

您可以使用一些gsettings

  • 在交流线路上处理

     gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action 'nothing' 

    当盖子关闭时,这将禁用任何操作, 并且笔记本电脑插入AC。
    要简单地撤消:

      gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend' 

    可能的设置值而不是暂停是:

    ‘blank’,’suspend’,’shutdown’,’hibernate’,’interactive’,’nothing’,’logout’

  • 使用电池时的处理

     gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action 'nothing' 
  • 插入外接显示器时的处理

     gsettings set org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor 'nothing' 

使用gui

如果您更喜欢基于gui的解决方案,则必须安装

 sudo apt install dconf-editor 

调用

 dconf-editor& 

或者通过搜索程序破折号。

转到上面显示的图像第一行中显示的架构 ,然后进行设置:

在此处输入图像描述