I'm having this irritating problem, stated in the title on my Lenovo T14 with Ubuntu 20.04 (but had it also on ASUS Zen and Ubuntu 18.04). I have "Automatic suspend" set to 20 minutes "When on battery power" and disabled for "Plugged in" in the Gnome Settings. If I don't press any key, nor click/move mouse for 15 minutes and then unplug power cable, the laptop suspends in 5 minutes. If I don't press any key, nor click/move mouse for >= 20 minutes and then unplug power cable, the laptop suspends immediately.
I changed the "dconf-editor" --> /org/gnome/settings-daemon/plugins/power/use-time-for-policy
to false
as suggested on Laptop immediately suspends when going onto battery power, or https://ubuntuforums.org/showthread.php?t=1614861, but it doesn't seem to work.
Even if it did, wouldn't it disable timeout-triggered suspending completely? I still want it to suspend after 20 minutes "on battery power", which should be counted since unplugging of the power cable even if the computer was idle at that point.
Any suggestions?
Similar threads:
https://unix.stackexchange.com/questions/85251/my-laptop-shuts-down-every-time-i-unplug-it
https://bugs.launchpad.net/ubuntu/+source/gnome-power-manager/+bug/427629