[Unit] Description=Configure device events for linux-macbook ConditionPathExists=/proc/acpi/wakeup [Service] Type=oneshot ExecStart=/bin/sh -c "awk '$1 !~ /^LID/ && $3 ~ /enabled/ {print $1}' /proc/acpi/wakeup | xargs -I{} echo '{}' > /proc/acpi/wakeup" ExecStart=/bin/sh -c "awk '$1 ~ /^LID/ && $3 ~ /disabled/ {print $1}' /proc/acpi/wakeup | xargs -I{} echo '{}' > /proc/acpi/wakeup" RemainAfterExit=yes TimeoutSec=0 [Install] WantedBy=multi-user.target