Ubuntu设置笔记本电脑合盖时不挂起

有些情况需要我们的笔记本在关闭盖子后,依然需要维持正常工作,而不是挂起或休眠。

在Ubuntu默认的设置中,无法设置关闭盖子的操作,因此需要手动修改配置文件

参考文件:https://linux.cn/article-15015-1.html

更改登录配置

打开 /etc/systemd/logind.conf 文件,如果没有则创建此文件

文件中通常有如下内容

bash 复制代码
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#HandleRebootKey=reboot
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RuntimeDirectoryInodesMax=400k
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192

在文件末尾追加如下三行

bash 复制代码
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore

参数说明

bash 复制代码
suspend:合盖时挂起
lock:合盖时锁定
ignore:什么都不做
poweroff:关机
hibernate:合盖时休眠
相关推荐
水天需01021 小时前
Vim 分屏操作详解
linux
电子小子洋酱21 小时前
Linux显示设备驱动开发 Drm驱动&&Makefile
linux·驱动开发·笔记
huangyuchi.21 小时前
【Linux 网络】理解并应用应用层协议:HTTP(附简单HTTP服务器C++代码)
linux·服务器·网络·网络协议·http·c/c++
电子小子洋酱21 小时前
Linux驱动开发学习笔记(更新中)
linux·笔记·单片机
行思理21 小时前
Linux多PHP如何切换系统默认PHP版本
linux·运维·php
jimy11 天前
ps aux|grep pid 和 ps -p pid 的区别
java·linux·开发语言
weixin_437546331 天前
注释文件夹下脚本的Debug
java·linux·算法
zfj3211 天前
容器 的 cpu request limit 与 linux cgroups 的关系
linux·运维·服务器·kubernetes·cgroup
Lueeee.1 天前
Linux内核镜像分析
linux·服务器
专家大圣1 天前
摆脱局域网!Logseq 搭配cpolar公网访问让笔记管理更自由
linux·网络·docker·内网穿透·cpolar