root@user:/home/user# 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]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchDocked=ignore
!!!将#HandleLidSwitch=suspend 改为 HandleLidSwitch=ignore
重启一下配置:systemctl restart systemd-logind
图形操作:




本文介绍如何在Linux系统中通过编辑systemd-logind配置文件,更改笔记本电脑盖子合上时的行为,从默认的挂起到忽略此动作。
6348

被折叠的 条评论
为什么被折叠?



