I recently started using org's clock features, however after repeatedly forgetting to clock out after closing my laptop, I decided to set up an automated clock-out on sleep.
brew install sleepwatcher(if not already installed)- Create file at
~/.sleepwith the following contents:
#!/usr/bin/env bash
/usr/local/bin/emacsclient -e "(org-clock-out)"Substitute the full path of emacsclient for whatever which emacsclient gives you, as sleepwatcher will likely not have emacsclient on it's PATH.
chmod +x ~/.sleep- done!