Emacs Lisp: take a screenshot withing GNU Emacs and maim
maim
is small shell utility that takes screenshots, and with the option -s
it allows cropping of a screenshot. This makes it handy to bind the <print>
key to screenshot
function. After taking screenshot, Emacs is to open the Dired buffer with list of screenshots. From there you may send them by email or do whatever you want. If you are giving it the universal argument C-u 0
it will crop the rectangle on the screen.
This may be very handy when working within the GNU Emacs operating environment and when you wish to take a screenshot and quickly do something with the file.
Update on 2019-08-14
If you are using the maim
command just as me then C-u 0 M-x screenshot
will give you a croping feature, so you may crop part of the screen. Otherwise C-u NUMBER M-x screenshot
will wait for number of seconds and then invoke the screenshot.
defvar *image-directory* "/home/data1/protected/Media/Pictures/WebScreenshots")
(
defun screenshot (&optional crop)
("Takes screenshots and opens the folder in Dired"
"p")
(interactive let* ((image-capture-program (if (= current-prefix-arg 0) "maim -s" "maim"))
(if (and current-prefix-arg (not (zerop current-prefix-arg)))
(sleep-seconds (0))
current-prefix-arg ".png")
(image-type "%Y"))
(year (format-time-string "%m"))
(month (format-time-string "%Y-%d-%m"))
(date (format-time-string directory (concat *image-directory* "/" year "/" month "/" date))
(directory "/" (format-time-string "%Y-%d-%m-%T") image-type))
(filename (concat " \"" filename "\"")))
(command (concat image-capture-program directory t)
(make-directory
(sleep-for sleep-seconds)
(shell-command command)directory)
(find-file-other-window
(revert-buffer)))
"<print>") 'screenshot) (global-set-key (kbd
Always sort files by groups, people and chronologically. It will make your life easier.
Leave Your Comment or Contact GNU.Support
Contact GNU.Support now. There is a simple rule at GNU.Support: if we can help you, we do, whenever and wherever necessary, and it's the way we've been doing business since 2002, and the only way we know