Basically it’s just one line to the file:

I did HandlePowerKey=suspend in /etc/systemd/logind.conf

I created a new file: /etc/systemd/logind.conf.d/suspend.conf

then did: systemctl kill -s HUP systemd-logind

After this, pressing power button is only suspending it.


Here’s some explanation to the problem with MacBook Air: Turn off power button?