I have recently installed Ubuntu 23.04 on a laptop. I set it to never suspend on lid close in gnome tweaks as it was meant to sit plugged in and closed on a shelf and be ssh-ed into.
I began using it on battery recently and now require it to sleep when it is on battery and the lid is closed. I re-enabled sleep in tweaks and modified logind.conf for the respective power conditions after gnome tweaks changed it for both power conditions. That seemingly did nothing as the system still sleeps on AC power, when the lid is closed. I even purged all there was to gnome-tweaks, but the issue still persists.
Edit:
----------------------------------------
Gnome-tweaks didn't seem to modify logind.conf, meaning that there must be some other power management system in place, that the application modifies. I am new to Linux, so I don't really know how things work here.
----------------------------------------
Every post or thread I go to, says to modify that file, or use gnome tweaks. There were also some that required some other software, that I was unable to install, though I presume they do the same thing.
Here are some examples of my configuration:
dev@ThinkPad-T440:~$ gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action
'nothing'
dev@ThinkPad-T440:~$ gsettings get org.gnome.settings-daemon.plugins.power lid-close-battery-action
'suspend'
logind.conf:
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=ignore
#HandleLidSwitchDocked=ignore
I have also tried systemctl daemon-reload
and plain rebooting. Both of which did nothing.
Some technical information:
Version: Ubuntu 23.04 64 bit
Kernel: Linux 6.2.0-26-Generic
RAM: 8.00 GB
CPU: Intel Code i7 4600U
The BIOS is on the latest version and so is the firmware of all devices.