Skip to content

Instantly share code, notes, and snippets.

@travisbhartwell
Created June 22, 2018 13:54
Show Gist options
  • Save travisbhartwell/2ea4cb287ddbf98610c25c762a967f4b to your computer and use it in GitHub Desktop.
Save travisbhartwell/2ea4cb287ddbf98610c25c762a967f4b to your computer and use it in GitHub Desktop.
#!/usr/local/bin/bash
EMACS_SERVER_DIR=/Users/travisbhartwell/.emacs.d/server
EMACS_SERVER_FILE=$(cd "${EMACS_SERVER_DIR}" && /usr/local/bin/realpath $(ls -t "${EMACS_SERVER_DIR}" | head -n1))
if [ -n "$(ps -ef | grep '[e]macs')" -a -e "${EMACS_SERVER_FILE}" ]; then
output="$(/usr/local/bin/emacsclient -f ${EMACS_SERVER_FILE} -e '(tbh-org-get-clock-time)' | tr -d '\"')"
if [ "${output}" ]; then
echo "Clocked In"
echo "---"
echo "${output}"
exit 0
fi
fi
echo "Clocked out"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment