Skip to content

Instantly share code, notes, and snippets.

@mrf345
Created April 3, 2018 16:38
Show Gist options
  • Save mrf345/6996d5ad6a5328d49638d40e84e0ffde to your computer and use it in GitHub Desktop.
Save mrf345/6996d5ad6a5328d49638d40e84e0ffde to your computer and use it in GitHub Desktop.
Put linux to sleep if emacs idle for 1 hour
;; Put system to sleep, if emacs idle for 1 hour
(defun gotoSleep ()
(interactive)
(minibuffer-message "Going to Sleep !")
(shell-command "systemctl suspend")
)
(run-with-idle-timer (* 60 60) nil 'gotoSleep)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment