summary refs log tree commit diff
diff options
context:
space:
mode:
authorAntero Mejr <antero@mailbox.org>2022-07-26 16:48:58 -0400
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2022-07-27 20:37:19 +0200
commit97285a431baa1f4ab4e78a52648f872326a01c92 (patch)
treea0c8ec8384644aae0aeb92a16285e9244ed5c10d
parent3b1bac3b97da98111e409e0544967c0514b3de53 (diff)
downloadguix-97285a431baa1f4ab4e78a52648f872326a01c92.tar.gz
gnu: Add grimshot.
* gnu/packages/wm.scm (grimshot): New variable.

Reviewed-by: Maxime Devos <maximedevos@telenet.be>
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
-rw-r--r--gnu/packages/wm.scm43
1 files changed, 43 insertions, 0 deletions
diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index f27f8af8d4..fc5c173d00 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -2799,3 +2799,46 @@ Type=Application~%"
      "Avizo is a simple notification daemon for Sway, mainly intended to be
 used for multimedia keys.")
     (license license:gpl3+)))
+
+(define-public grimshot
+  (package
+    (inherit sway)
+    (name "grimshot")
+    (source (origin
+              (inherit (package-source sway))
+              (snippet #~(delete-file "contrib/grimshot.1"))))
+    (build-system copy-build-system)
+    (arguments
+     (list #:install-plan #~`(("grimshot" "bin/")
+                              ("grimshot.1" "usr/share/man/man1/"))
+           #:phases #~(modify-phases %standard-phases
+                        (add-after 'unpack 'chdir
+                          (lambda _
+                            (chdir "contrib")))
+                        (add-after 'chdir 'patch-script-dependencies
+                          (lambda* (#:key inputs #:allow-other-keys)
+                            (substitute* "grimshot"
+                              (("\\b(date|grim|jq|notify-send|slurp|swaymsg|wl-copy)\\b"
+                                _ binary)
+                               (search-input-file
+                                inputs (string-append "bin/" binary))))))
+                        (add-after 'patch-script-dependencies 'build-man-page
+                          (lambda _
+                            (with-input-from-file "grimshot.1.scd"
+                              (lambda _
+                                (with-output-to-file "grimshot.1"
+                                  (lambda _
+                                    (invoke "scdoc"))))))))))
+    (native-inputs (list scdoc))
+    (inputs (list coreutils
+                  grim
+                  jq
+                  libnotify
+                  slurp
+                  sway
+                  wl-clipboard))
+    (synopsis "Screenshot utility for the Sway window manager")
+    (description "Grimshot is a screenshot utility for @code{sway}.  It provides
+an interface over @code{grim}, @code{slurp} and @code{jq}, and supports storing
+the screenshot either directly to the clipboard using @code{wl-copy} or to a
+file.")))