#!/usr/bin/env bash
set -euo pipefail

reason="caffe: keep system awake until this process exits"

echo "Caffe active. This terminal is inhibiting suspend."
echo "Press Ctrl+C or close this terminal to return to normal."
echo

exec systemd-inhibit \
  --what=sleep:shutdown:idle \
  --who="caffe" \
  --why="$reason" \
  --mode=block \
  sleep infinity
