How to suspend only when off AC power

Archlinux logo

Works on Archlinux using systemd 239.370-1:

[hendry@t480s ~]$ grep -v ^# /etc/systemd/logind.conf
[Login]
HandleLidSwitchExternalPower=ignore
Found any of my content useful?