all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Antero Mejr via Guix-patches via <guix-patches@gnu.org>
To: 56770@debbugs.gnu.org
Cc: Antero Mejr <antero@mailbox.org>, maximedevos@telenet.be
Subject: [bug#56770] [PATCH v2] gnu: Add grimshot.
Date: Tue, 26 Jul 2022 13:58:17 -0400	[thread overview]
Message-ID: <20220726175817.422441-1-antero@mailbox.org> (raw)
In-Reply-To: <20220725205412.336878-1-antero@mailbox.org>

* gnu/packages/wm.scm (grimshot): New variable.
---
changes for v2:
1. using copy-build-system instead of trivial-build-system because it is
simpler, copy-build-system handles unpacking the source
2. using snippet to delete the precompiled grimshot.1 (from review)
3. using this-package-input when substituting the script (from review)
4. using invoke to build man page (from review)
5. put inputs on separate lines (from guix style)

Maxime, this code: (source (file-append (package-source sway) "/contrib"))
didn't work for me, but inheriting the package source worked
with --with-git-url.

 gnu/packages/wm.scm | 65 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index 8fef7de77b..1e60ceb27b 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -2742,3 +2742,68 @@ (define-public avizo
      "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 #~(begin
+                           (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-deps
+                          (lambda _
+                            (substitute* "grimshot"
+                              (("date ")
+                               (string-append #$(this-package-input "coreutils")
+                                              "/bin/date "))
+                              (("jq ")
+                               (string-append #$(this-package-input "jq")
+                                              "/bin/jq "))
+                              (("swaymsg ")
+                               (string-append #$(this-package-input "sway")
+                                              "/bin/swaymsg "))
+                              (("notify-send ")
+                               (string-append #$(this-package-input "libnotify")
+                                              "/bin/notify-send "))
+                              (("grim ")
+                               (string-append #$(this-package-input "grim")
+                                              "/bin/grim "))
+                              (("slurp ")
+                               (string-append #$(this-package-input "slurp")
+                                              "/bin/slurp "))
+                              (("wl-copy ")
+                               (string-append
+                                #$(this-package-input "wl-clipboard")
+                                "/bin/wl-copy ")))))
+                        (add-after 'patch-script-deps 'build-man-page
+                          (lambda _
+                            (with-input-from-file "grimshot.1.scd"
+                              (lambda _
+                                (with-output-to-file "grimshot.1"
+                                  (lambda _
+                                    (invoke #+(file-append
+                                               (this-package-native-input
+                                                "scdoc")
+                                               "/bin/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.")))
-- 
2.37.0





  parent reply	other threads:[~2022-07-26 18:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 20:54 [bug#56770] [PATCH] gnu: Add grimshot Antero Mejr via Guix-patches via
2022-07-26 15:46 ` Maxime Devos
2022-07-26 15:52   ` Maxime Devos
2022-07-26 15:49 ` Maxime Devos
2022-07-26 17:58 ` Antero Mejr via Guix-patches via [this message]
2022-07-26 18:17   ` [bug#56770] [PATCH v2] " Maxime Devos
2022-07-26 18:29   ` Maxime Devos
2022-07-26 20:48 ` [bug#56770] [PATCH v3] " Antero Mejr via Guix-patches via
2022-07-26 22:06   ` [bug#56770] LGTM: [PATCH v3] gnu: Add grimshot. (LGTM) Maxime Devos
2022-07-27 18:42     ` bug#56770: " Liliana Marie Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220726175817.422441-1-antero@mailbox.org \
    --to=guix-patches@gnu.org \
    --cc=56770@debbugs.gnu.org \
    --cc=antero@mailbox.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.