Should the laptop be plugged in when not in use?

Don't.

The laptop doesn't need to be plugged in all the time when it's not in use. Lithium batteries used in modern notebook computers usually have a battery management system, which can prevent overcharge and deep discharge, thus protecting the health of the battery. After the laptop battery is fully charged, you can choose to unplug the power supply, and then the battery will slowly and naturally discharge, and it will not be dead immediately. Doing so can reduce the long-term full charge of the battery and help to extend the battery life.