Skip to content

Instantly share code, notes, and snippets.

@jonEbird
Last active August 29, 2015 14:04
Show Gist options
  • Save jonEbird/f44e8d68af6b86e63407 to your computer and use it in GitHub Desktop.
Save jonEbird/f44e8d68af6b86e63407 to your computer and use it in GitHub Desktop.
Run screenkey for only a brief period. Intention to bind to key and use during screencasts.
(defvar screenkey-timeout 4
"Number of seconds to allow screenkey to run normally")
(defun screenkey-timed (&optional timeout)
"Run an external command and then asynchronously kill it after timeout"
(interactive)
(start-process "screenkey" "*screenkey*" "screenkey" "--no-detach")
(run-at-time (format "%d sec" (or timeout screenkey-timeout)) nil
'(lambda () (delete-process "*screenkey*"))))
(global-set-key (kbd "C-M-k") 'screenkey-timed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment