From patchwork Tue Jul 26 17:58:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antero Mejr X-Patchwork-Id: 41008 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id F1DF527BBEA; Tue, 26 Jul 2022 19:04:26 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 727E427BBE9 for ; Tue, 26 Jul 2022 19:04:26 +0100 (BST) Received: from localhost ([::1]:57552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGOuv-0006Az-Gl for patchwork@mira.cbaines.net; Tue, 26 Jul 2022 14:04:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGOpi-0002x6-Fy for guix-patches@gnu.org; Tue, 26 Jul 2022 13:59:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36361) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGOpi-0005x7-7R for guix-patches@gnu.org; Tue, 26 Jul 2022 13:59:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oGOpi-0001hU-2v for guix-patches@gnu.org; Tue, 26 Jul 2022 13:59:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56770] [PATCH v2] gnu: Add grimshot. References: <20220725205412.336878-1-antero@mailbox.org> In-Reply-To: <20220725205412.336878-1-antero@mailbox.org> Resent-From: Antero Mejr Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 26 Jul 2022 17:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56770 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56770@debbugs.gnu.org Cc: Antero Mejr , maximedevos@telenet.be Received: via spool by 56770-submit@debbugs.gnu.org id=B56770.16588583246501 (code B ref 56770); Tue, 26 Jul 2022 17:59:02 +0000 Received: (at 56770) by debbugs.gnu.org; 26 Jul 2022 17:58:44 +0000 Received: from localhost ([127.0.0.1]:54343 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGOpP-0001gn-OE for submit@debbugs.gnu.org; Tue, 26 Jul 2022 13:58:44 -0400 Received: from mout-p-201.mailbox.org ([80.241.56.171]:36588) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGOpJ-0001gO-IP for 56770@debbugs.gnu.org; Tue, 26 Jul 2022 13:58:42 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4Lsl5K420zz9sSP; Tue, 26 Jul 2022 19:58:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1658858309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=KZ73I8VjCZvivUlliFO96mloaPSgWcJW6GbylMT0ZyM=; b=IxuViQLQmxwKGhfept9ITYoHfKi71P0C6XYx/fz8v2/dFoGanlyMlkyFssMgpsXZm1vMYi Usxllp2moHDkb7raVtsGZY0Rco6ruMwpaNDtTHdKXVcZhCBqPe5nSke5A53ZXUiOCuh8Ii es9CXMQY64hOyEDmhDn5qEuHofF/ESV5TIROwV2LTP8EybZG82mNR5DYrg7qLFaKORgUxb 1/fa2wenkFmoNsmExK42A7sd1UgsmuF0DXH/lu/xR/2Nl6cXjOS5WVCnXDn788jfJbEQ86 CN4sPD25Xrf0Vfx8uzvtpflQscQ+2qzzvUXiP4pJCgh6OUYP+fj3SnR+htRvjg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1658858307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=KZ73I8VjCZvivUlliFO96mloaPSgWcJW6GbylMT0ZyM=; b=uiD82nWQlN9fowOx/u8ktIi9L36gF+tf6N+mE03zdmlQUI36qAmxUwtinXq9owOsNcT/+K 974i/2nt97Gd+fafu3vFQWdboOHFRkgS/ULEi7fKQXiRapInr7q0L06ETJij2348jgkgiE nhMYU63zxhsUgN/VNrEpzY0UEJ2ndra7m7zoD0GJgzlpFv1IjFMDhgQrH5f4Pa6IsK7Xks XoSyoaXWVKM0yTJoVQXdxZ62UbkwDpfFLLelKclB+L7au3BUYItHUltH4r1t+/AigHdSkj 2K6aEXSn+8h8E8UQDbI656eZcnHNXFwLQ2ygHlcnM2kVHgJXQBi1DhRAK0LHJQ== Date: Tue, 26 Jul 2022 13:58:17 -0400 Message-Id: <20220726175817.422441-1-antero@mailbox.org> MIME-Version: 1.0 X-MBO-RS-ID: d7c348aee44a3703d54 X-MBO-RS-META: pi4juw8eou8wm8dqeqqa33dprj6d8hcz X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Antero Mejr X-ACL-Warn: , Antero Mejr via Guix-patches X-Patchwork-Original-From: Antero Mejr via Guix-patches via From: Antero Mejr X-getmail-retrieved-from-mailbox: Patches * 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.")))