[Top][All Lists]

[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:

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."
  (setq nsecs (or nsecs "5"))
  (setq nsecs (or nsecs "{nsecs}"))
   `((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\")

(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
  (find-bgprocess '("sh" "-c" "sleep 5 && scrot          --select
  (find-bgprocess '("sh" "-c" "sleep 5 && scrot --border --select
  (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... =(

    Eduardo Ochs

reply via email to

[Prev in Thread] Current Thread [Next in Thread]