From mboxrd@z Thu Jan 1 00:00:00 1970 From: Viktor Rosenfeld Subject: Re: RFQ - new contribution - org-screenshot.el Date: Tue, 21 May 2013 19:42:02 +0200 Message-ID: <20130521174202.GB56422@client199-78.wlan.hu-berlin.de> References: <87mwru8f57.wl%max@openchat.com> <20130521174014.GA56422@client199-78.wlan.hu-berlin.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:44904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeqZf-0003Wa-JR for emacs-orgmode@gnu.org; Tue, 21 May 2013 13:42:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UeqZa-0000OB-Ez for emacs-orgmode@gnu.org; Tue, 21 May 2013 13:42:11 -0400 Received: from mail-bk0-x22d.google.com ([2a00:1450:4008:c01::22d]:34802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeqZa-0000Nx-4k for emacs-orgmode@gnu.org; Tue, 21 May 2013 13:42:06 -0400 Received: by mail-bk0-f45.google.com with SMTP id je2so576625bkc.4 for ; Tue, 21 May 2013 10:42:05 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20130521174014.GA56422@client199-78.wlan.hu-berlin.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Haider Rizvi , emacs-orgmode@gnu.org --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Forgot to attach the patch in my last mail. Sorry about the double posting. Viktor Rosenfeld wrote: > Hi, > > Haider Rizvi wrote: > > > Max Mikhanosha writes: > > > > > Hi All, > > > > > > I've been writing some documentation in OrgMode with screenshots, and > > > as with any screenshot taking, it takes a while to get one just right. > > > > > > A few tiny helper utilities, quickly snowballed into this :-) It may > > > need some cleanup, but IMHO its too awesome not to share it with the > > > list. > > > > > > To try it out, you'll need /usr/bin/scrot which is available as > > > "scrot" package on most distributions. > > > > Cool. Can you make this a bit portable. On Mac OSX, the utility is > > called screencapture, and can be run with the same flags. > > Attached is a very first try at making org-screenshot run on OS X. Many > open issues remain: > > - Clicking in a window will not take a screenshot using `screencapture > -s' but aborts the process altogether and does not create a file. To > capture a window one has to use `screencapture -w'. Another option is > to use `screencapture -i' and toggle between window and selection mode > using the space bar. The problem with this approach is that hitting > the control key will place the screenshot into the clipboard and not > create a file either. > > - Delay does not work because `screencapture -d' has a different > meaning. To delay a screenshot, one has to use `screencapture -T'. > > Cheers, > Viktor > > > Here is a > > piece of code that was published earlier with a sample use. > > > > http://thread.gmane.org/gmane.emacs.orgmode/69221/focus=69272 > > > > ,---- > > | #+BEGIN_SRC emacs-lisp > > | (defun paste-clipboard-to-file (&optional filename temp-dir) > > | "Take a screenshot using the crosshairs and saveit to FILENAME, > > | if it is given or to a temp file in the TEMP-DIR > > | directory. Then add an orgmode style link at point." > > | (interactive) > > | (let* ((temporary-file-directory (or temp-dir "images")) > > | (fname (or filename (make-temp-file "img" nil ".jpg")))) > > | (call-process-shell-command (concat > > | "/usr/sbin/screencapture -s " fname)) > > | (insert "\n[[file:" fname "]]") > > | (org-display-inline-images))) > > | ;; > > | (global-set-key (kbd "C-c p") 'paste-clipboard-to-file) > > | > > | #+END_SRC > > `---- > > > > Regards, > > -- > > Haider > > > > --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-org-screenshot-Let-user-configure-capture-program.patch" >From 5938b848f4b9b30b25c903e3487834f9400f6ad9 Mon Sep 17 00:00:00 2001 From: Viktor Rosenfeld Date: Tue, 21 May 2013 19:32:16 +0200 Subject: [PATCH] org-screenshot: Let user configure capture program. * org-screenshot.el (org-screenshot-capture-binary): Configure the binary to capture a screenshot. (org-screenshot-take): Do not use hardcoded `scrot' binary. --- contrib/lisp/org-screenshot.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/lisp/org-screenshot.el b/contrib/lisp/org-screenshot.el index a54cb8f..54c8074 100644 --- a/contrib/lisp/org-screenshot.el +++ b/contrib/lisp/org-screenshot.el @@ -85,6 +85,11 @@ "Options for taking and managing screen-shots" :group 'org-link) +(defcustom org-screenshot-capture-binary "scrot" + "Binary to capture screen contents. Use `scrot' on Linux and `screencapture' on Mac OS X." + :type 'string + :group 'org-screenshot) + (defcustom org-screenshot-image-directory "./images/" "Directory in which screenshot image files will be stored, it be automatically created if it does't already exist." @@ -307,7 +312,7 @@ screenshot is done, any more `C-u' after that increases delay by (or (apply 'start-process (append - (list "scrot" "*scrot*" "scrot" "-s" path) + (list "scrot" "*scrot*" org-screenshot-capture-binary "-s" path) (when (plusp delay) (list "-d" (format "%d" delay))))) (error "Unable to start scrot process"))) -- 1.8.2.3 --BOKacYhQ+x31HxR3--