0
点赞
收藏
分享

微信扫一扫

笔记本安装Ubuntu关闭盖子不休眠设置

木樨点点 2022-02-15 阅读 166

一、打开配置文件

sudo vim /etc/systemd/logind.conf

二、配置介绍

#  This file is part of systemd.
# 
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.

[Login]
#配置分配的虚拟终端(VTs)数量,默认6个
#NAutoVTs=6

#标识一个将无条件预留给autovt@.的虚拟终端服务激活
#ReserveVT=6

#配置用户退出时是否停止该用户的进程
#KillUserProcesses=no

#设置进程被杀死的用户
#KillOnlyUsers=

#设置不被杀死进程的用户
#KillExcludeUsers=root

#指定系统关闭或睡眠请求延迟的最长时间,默认为5秒
#InhibitDelayMaxSec=5

#为电源操作,默认关机
#HandlePowerKey=poweroff

#为电源操作,默认休眠到内存
#HandleSuspendKey=suspend

#为电源操作,默认休眠到硬盘
#HandleHibernateKey=hibernate

#关盖操作,默认休眠
#HandleLidSwitch=ignore

#使用外部电源关盖操作,默认休眠
#HandleLidSwitchExternalPower=ignore

#插了扩展坞或者连接多个显示器关盖子操作,默认无操作
#HandleLidSwitchDocked=ignore

#电源事件所触发的systemd-logind操作是否应该忽略高级inhibitor锁
#PowerKeyIgnoreInhibited=no

#休眠(到内存)事件所触发的systemd-logind操作是否应该忽略高级inhibitor锁
#SuspendKeyIgnoreInhibited=no

#休眠(到磁盘)事件所触发的systemd-logind操作是否应该忽略高级inhibitor锁
#HibernateKeyIgnoreInhibited=no

#关盖子事件所触发的systemd-logind操作是否应该忽略高级inhibitor锁
#LidSwitchIgnoreInhibited=yes

#当开机/唤醒时间 尚未超出此处设置的时间长度时, systemd将延迟响应合上盖子(lid)硬件事件,默认30秒
#HoldoffTimeoutSec=30s

#当系统持续处于空闲状态超过 IdleActionSec= 所设置的时间后,应该执行何种操作,默认无操作。
#IdleAction=ignore

#当系统持续处于空闲状态超过此处设置的时长之后将会自动执行IdleAction=设定的动作
#IdleActionSec=30min

#为每个已登录用户设置运行时目录 $XDG_RUNTIME_DIR 的最大尺寸
#RuntimeDirectorySize=10%

#当用户完全退出登录时(也就是退出最后一个登录会话时), 是否销毁所有属于该用户的 SysV 与 POSIX IPC 对象
#RemoveIPC=yes

#控制最多允许同时存在多少个inhibitor锁,默认值是8192(8K)
#InhibitorsMax=8192

#控制最多允许同时管理多少个用户会话,默认值是 8192 
#SessionsMax=8192

三、修改配置如下

HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore

四、重启服务

sudo service systemd-logind restart
举报

相关推荐

0 条评论