The power category in GNOME Tweaks only show a "suspend when laptop lid is closed". However, there is no distinction between whether the laptop is plugged (for instance to a docking station or a charger) or operating on battery power.
In my case, I would like my laptop to suspend when closing the lid on battery power, but leave it when plugged to its charger. Is there a way to achieve that?