-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtv-byzanz.el
49 lines (41 loc) · 1.6 KB
/
tv-byzanz.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
;;; tv-byzanz.el --- Record Emacs screencast with byzanz. -*- lexical-binding: t -*-
;;
;;; Code:
(defgroup byzanz-record nil "Record screencast."
:group 'multimedia)
;;;###autoload
(defun byzanz-record (file)
"Record a screencast with byzanz."
(interactive "FRecord to file: ")
(let* ((height (number-to-string (+ (frame-pixel-height)
;; minibuf+mode-line
40)))
(width (number-to-string (frame-pixel-width)))
(process (start-process "byzanz" "*byzanz log*"
"byzanz-record"
"--exec=sleep 1000000"
"--delay=5"
"-c" "-w" width "-h" height file)))
(byzanz-record-mode 1)
(set-process-sentinel
process (lambda (_proc event)
(when (string= event "finished\n")
(byzanz-record-mode -1)
(message "Screencast recorded to `%s'" file))))))
(defun byzanz-record-stop ()
"Stop byzanz recording.
Don't bind this to global-map but to `byzanz-record-mode-map' instead."
(interactive)
(call-process "killall" nil nil nil "sleep"))
(defvar byzanz-record-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "S-<f12>") 'byzanz-record-stop)
map))
(define-minor-mode byzanz-record-mode
"A minor mode to stop byzanz-record."
:group 'byzanz-record
:global t
(message "Byzanz started recording, hit `S-<f12>' to stop"))
(put 'byzanz-record-mode 'no-helm-mx t)
(provide 'tv-byzanz)
;;; tv-byzanz.el ends here