Skip to content

Instantly share code, notes, and snippets.

@ethan-leba
Last active June 2, 2022 09:53
Show Gist options
  • Save ethan-leba/cb087f42a78d13d2d84c7a88f658dcb4 to your computer and use it in GitHub Desktop.
Save ethan-leba/cb087f42a78d13d2d84c7a88f658dcb4 to your computer and use it in GitHub Desktop.
Clock out of org on laptop sleep (MacOS)

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.

Instructions

  1. brew install sleepwatcher (if not already installed)
  2. Create file at ~/.sleep with 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.

  1. chmod +x ~/.sleep
  2. done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment