如何防止 Ubuntu 在合上盖子时进入睡眠状态

Bar*_*ba3 3 suspend laptop lid power-management

我想防止我的系统(旧 HP 笔记本电脑上的 Ubuntu 22.04)在合上盖子时进入睡眠状态。

我已经尝试编辑我的/etc/systemd/logind.conf

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

在编辑之前,我的系统一合上盖子就进入睡眠状态;但现在需要一段时间才能入睡。奇怪的是,当盖子没有关闭时,只要我愿意,系统就会保持清醒状态。

我不知道任何日志是否有用;或者可能是什么原因。

$ gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action
suspend
Run Code Online (Sandbox Code Playgroud)

$ gsettings get org.gnome.settings-daemon.plugins.power lid-close-battery-action
suspend
Run Code Online (Sandbox Code Playgroud)

小智 5

接受的答案在我的情况下不起作用(也在 Ubuntu 22.04 上)。我必须安装 GNOME Tweaks,它可以在universe存储库中找到:

sudo apt update
sudo add-apt-repository universe
sudo apt install gnome-tweaks
Run Code Online (Sandbox Code Playgroud)

并禁用笔记本电脑盖关闭时暂停