Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for gnome-screenshot util #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

[![MELPA](https://melpa.org/packages/org-ros-badge.svg)](https://melpa.org/#/org-ros)

# Changes

- Added Suppor for `gnome-screenshot`

My implementation for **"how do I copy-paste images into an org file?"** issue.

ros is invoked with <kbd>M-x</kbd> `org-ros` <kbd>RET</kbd>, it waits for your selection, takes a screenshot and saves it as `orgfileopened.org_YYYYMMDD_hhmmss.png`.
Expand Down
10 changes: 7 additions & 3 deletions org-ros.el
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
(defcustom org-ros-secondary-screencapture-switch "-s"
"Secondary screencapture software selection switch."
:type 'string)

;;;###autoload
(defun org-ros ()
"Screenshots an image to an org-file."
Expand All @@ -58,8 +58,12 @@
(format-time-string "%Y%m%d_%H%M%S")
".png")))
(if (executable-find org-ros-primary-screencapture)
(call-process org-ros-primary-screencapture nil nil nil org-ros-primary-screencapture-switch filename)
(call-process org-ros-secondary-screencapture nil nil nil org-ros-secondary-screencapture-switch filename))
(if (equal org-ros-primary-screencapture "gnome-screenshot")
(call-process org-ros-primary-screencapture nil nil nil "-a" "-f" filename)
)
(call-process org-ros-primary-screencapture nil nil nil org-ros-primary-screencapture-switch filename)
(call-process org-ros-secondary-screencapture nil nil nil org-ros-secondary-screencapture-switch filename)
)
(insert "[[" filename "]]")
(org-display-inline-images t t))
(message "File created and linked..."))
Expand Down