Working Ninja
2018-01-06T17:16:21
Linux on MacBook - Clamshell Mode

Completely disable systemd power-saving modules:

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Disable systemd lid switch (for laptops):

sed -i -e 's/HandleLidSwitch=suspend/HandleLidSwitch=ignore/' /etc/systemd/logind.conf

The above became necessary as systemd-logind was detecting that the lid was closed and calling suspend.target. The calls were numerous and consumed large amounts of CPU.

Sources:
https://askubuntu.com/a/858617 and https://unix.stackexchange.com/a/52645