[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Screenshots, frame shots straight from Emacs
From: |
Eduardo Ochs |
Subject: |
Re: Screenshots, frame shots straight from Emacs |
Date: |
Sat, 31 Jul 2021 23:59:19 -0300 |
By the way, here is what I use to take screenshots...
This is a "5-minute hack" built on top of eev, following the style
that I explained here:
http://angg.twu.net/emacsconf2020.html
http://angg.twu.net/.emacs.videos.html#eev2020
Here is its only defun (and a defalias):
;; Skel: (find-find-links-links-new "sshot" "nsecs" "")
;; Test: (find-sshot-links)
;;
(defun find-sshot-links (&optional nsecs &rest pos-spec-list)
"Visit a temporary buffer containing hyperlinks taking a screenshot."
(interactive)
(setq nsecs (or nsecs "5"))
(setq nsecs (or nsecs "{nsecs}"))
(apply
'find-elinks
`((find-sshot-links ,nsecs ,@pos-spec-list)
(find-sshot-links "{nsecs}")
;; Convention: the first sexp always regenerates the buffer.
(find-efunction 'find-sshot-links)
""
,(ee-template0 "\
\(eev \"sleep {nsecs} && scrot
--select /tmp/sshot.png\")
\(find-bgprocess '(\"sh\" \"-c\" \"sleep {nsecs} && scrot
--select /tmp/sshot.png\"))
\(find-bgprocess '(\"sh\" \"-c\" \"sleep {nsecs} && scrot --border
--select /tmp/sshot.png\"))
\(find-bgprocess \"xzgv /tmp/sshot.png\")
\(find-bgprocess \"gimp /tmp/sshot.png\")
\(find-fline \"/tmp/\" \"sshot.png\")
\(find-fline \"/tmp/sshot.png\")
\(imgbb-upload \"/tmp/sshot.png\")
")
)
pos-spec-list))
(defalias 'sshot 'find-sshot-links)
To take a screenshot I type M-x sshot, and I then get a temporary
buffer containing this:
# (find-sshot-links "5")
# (find-sshot-links "{nsecs}")
# (find-efunction 'find-sshot-links)
(eev "sleep 5 && scrot --select
/tmp/sshot.png")
(find-bgprocess '("sh" "-c" "sleep 5 && scrot --select
/tmp/sshot.png"))
(find-bgprocess '("sh" "-c" "sleep 5 && scrot --border --select
/tmp/sshot.png"))
(find-bgprocess "xzgv /tmp/sshot.png")
(find-bgprocess "gimp /tmp/sshot.png")
(find-fline "/tmp/" "sshot.png")
(find-fline "/tmp/sshot.png")
(xz "/tmp/sshot.png")
(imgbb-upload "/tmp/sshot.png")
The `find-bgprocess'es run scrot after a delay of 5 seconds... so I
have 5 seconds after executing the `find-bgprocess' to put the right
window (emacs-y or not) in the foreground, and then click on it in the
way that scrot or scrot --border expects.
I need to adapt that to include lines that run the other programs that
were suggested in this thread, but I was too busy in these last
weeks... =(
Cheers,
Eduardo Ochs
http://angg.twu.net/#eev
- Re: Screenshots, frame shots straight from Emacs, Emanuel Berg, 2021/07/01
- Re: Screenshots, frame shots straight from Emacs, Tomas Hlavaty, 2021/07/20
- Re: Screenshots, frame shots straight from Emacs, Leo Butler, 2021/07/20
- Re: Screenshots, frame shots straight from Emacs, Tomas Hlavaty, 2021/07/20
- Re: Screenshots, frame shots straight from Emacs, Leo Butler, 2021/07/20
- Re: Screenshots, frame shots straight from Emacs, Tomas Hlavaty, 2021/07/20
- Re: Screenshots, frame shots straight from Emacs, Tomas Hlavaty, 2021/07/31
- Re: Screenshots, frame shots straight from Emacs, Emanuel Berg, 2021/07/31
- Re: Screenshots, frame shots straight from Emacs,
Eduardo Ochs <=
- Re: Screenshots, frame shots straight from Emacs, Stefan Monnier, 2021/07/20
- Re: Screenshots, frame shots straight from Emacs, Stefan Monnier, 2021/07/20
- Re: Screenshots, frame shots straight from Emacs, Leo Butler, 2021/07/21
- Re: Screenshots, frame shots straight from Emacs, Stefan Monnier, 2021/07/21
- cl-lib questions (was: Re: Screenshots, frame shots straight from Emacs), Emanuel Berg, 2021/07/21
- Re: cl-lib questions, Stefan Monnier, 2021/07/21
- Re: cl-lib questions, Emanuel Berg, 2021/07/21
- Re: Screenshots, frame shots straight from Emacs, Tomas Hlavaty, 2021/07/22
- Re: Screenshots, frame shots straight from Emacs, Stefan Monnier, 2021/07/22
- Re: Screenshots, frame shots straight from Emacs, Emanuel Berg, 2021/07/22