Created
November 1, 2020 07:39
-
-
Save RyanGreenup/fdf8e83d885706d8b87941de6ab025c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-take-screenshot () | |
(interactive) | |
(let | |
;; Read Filename from Minibuffer | |
((filename (read-from-minibuffer "image file name: ")) | |
(directory "_media")) | |
;; Use maim to screenshot | |
(shell-command (format "maim --select %s/%s/%s.png" default-directory directory filename )) | |
;; Insert formatted link at point | |
(save-excursion (insert(format | |
"#+attr_html: :width 400px \n #+attr_latex: :width 0.4\\textwidth \n [[file:%s/%s.png]]" | |
directory filename))) | |
;; Message success to the minibuffer | |
(message "saved to %s as %s.png" directory filename) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment