unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#39922] [PATCH] Add clipnotify and clipmenu
@ 2020-03-05 10:25 Damien Cassou
  2020-03-11 17:44 ` bug#39922: " Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Damien Cassou @ 2020-03-05 10:25 UTC (permalink / raw)
  To: 39922

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

Here are 2 more packages, clipnotify and clipmenu. The latter depends on
the former.

If you want to teach me how to properly package for Guix, now is the
good time.

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-clipnotify.patch --]
[-- Type: text/x-patch, Size: 2613 bytes --]

From f6f5ed7f4d5ba8a75f8783a7958b6f73d43644dd Mon Sep 17 00:00:00 2001
From: Damien Cassou <damien@cassou.me>
Date: Wed, 4 Mar 2020 16:31:51 +0100
Subject: [PATCH 1/2] gnu: Add clipnotify.

* gnu/packages/xdisorg.scm (clipnotify): New variable.
---
 gnu/packages/xdisorg.scm | 46 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index dd05caa5f0..6bdcfcbf76 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -2116,3 +2116,49 @@ font and theme settings when a complete desktop environment (GNOME, KDE) is
 not running.  With a simple @file{.xsettingsd} configuration file one can avoid
 configuring visual settings in different UI toolkits separately.")
     (license license:bsd-3)))
+
+(define-public clipnotify
+  (package
+    (name "clipnotify")
+    (version "1.0.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/cdown/clipnotify.git")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1v3ydm5ljy8z1savmdxrjyx7a5bm5013rzw80frp3qbbjaci0wbg"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out  (assoc-ref outputs "out"))
+                    (bin  (string-append out "/bin"))
+                    (doc  (string-append %output "/share/doc/" ,name "-" ,version)))
+               (install-file "clipnotify" bin)
+               (install-file "README.md" doc)))))
+       #:make-flags (list "CC=gcc")
+       #:tests? #f))
+    (inputs
+     `(("libx11" ,libx11)
+       ("libXfixes" ,libxfixes)))
+    (home-page "https://github.com/cdown/clipnotify")
+    (synopsis "Notify on new X clipboard events")
+    (description "@command{clipnotify} is a simple program that, using the
+XFIXES extension to X11, waits until a new selection is available and then
+exits.
+
+It was primarily designed for clipmenu, to avoid polling for new selections.
+
+@command{clipnotify} doesn't try to print anything about the contents of the
+selection, it just exits when it changes.  This is intentional -- X11's
+selection API is verging on the insane, and there are plenty of others who
+have already lost their sanity to bring us xclip/xsel/etc.  Use one of those
+tools to complement clipnotify.")
+    (license license:public-domain)))
-- 
2.24.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-Add-clipmenu.patch --]
[-- Type: text/x-patch, Size: 3421 bytes --]

From 6d3202131236adc7f5c38e07541382d04ac68cf1 Mon Sep 17 00:00:00 2001
From: Damien Cassou <damien@cassou.me>
Date: Thu, 5 Mar 2020 08:26:23 +0100
Subject: [PATCH 2/2] gnu: Add clipmenu.

* gnu/packages/xdisorg.scm (clipmenu): New variable.
---
 gnu/packages/xdisorg.scm | 58 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index 6bdcfcbf76..f2d94d4039 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -2162,3 +2162,61 @@ selection API is verging on the insane, and there are plenty of others who
 have already lost their sanity to bring us xclip/xsel/etc.  Use one of those
 tools to complement clipnotify.")
     (license license:public-domain)))
+
+(define-public clipmenu
+  (let ((commit "a495bcc7a4ab125182a661c5808364f66938a87c")
+        (revision "1"))
+    (package
+     (name "clipmenu")
+     (version (string-append "5.6.0-"
+                             revision "." (string-take commit 7)))
+     (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+              (url "https://github.com/cdown/clipnotify.git")
+              (commit commit)))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          "12vvircdhl4psqi51cnfd6bqy85v2vwfcmdq1mimjgng727nwzys"))))
+     (build-system gnu-build-system)
+     (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-hardcoded-paths
+                  (lambda _
+                    (substitute* "clipmenud"
+                      (("has_clipnotify=0") "has_clipnotify=1")
+                      (("command -v clipnotify >/dev/null 2>&1 && has_clipnotify=1") "")
+                      (("clipnotify \\|\\| .*") (string-append (which "clipnotify") "\n"))
+                      (("xsel --logfile") (string-append (which "xsel") " --logfile")))
+                    (substitute* "clipmenu"
+                      (("xsel --logfile") (string-append (which "xsel") " --logfile")))
+                    #t))
+         (delete 'configure)
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out  (assoc-ref outputs "out"))
+                    (bin  (string-append out "/bin"))
+                    (doc  (string-append %output "/share/doc/" ,name "-" ,version)))
+               (install-file "clipdel" bin)
+               (install-file "clipmenu" bin)
+               (install-file "clipmenud" bin)
+               (install-file "README.md" doc)))))
+       #:tests? #f))
+     (inputs
+      `(("clipnotify" ,clipnotify)
+        ("xsel" ,xsel)))
+     (home-page "https://github.com/cdown/clipmenu")
+     (synopsis "Simple clipboard manager using dmenu or rofi and xsel")
+     (description "Start @command{clipmenud}, then run @command{clipmenu} to
+select something to put on the clipboard.
+
+When @command{clipmenud} detects changes to the clipboard contents, it writes
+them out to the cache directory.  @command{clipmenu} reads the cache directory
+to find all available clips and launches @command{dmenu} (or @command{rofi},
+depending on the value of @code{CM_LAUNCHER}) to let the user select a clip.
+After selection, the clip is put onto the PRIMARY and CLIPBOARD X selections.")
+     (license license:public-domain))))
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#39922: [PATCH] Add clipnotify and clipmenu
  2020-03-05 10:25 [bug#39922] [PATCH] Add clipnotify and clipmenu Damien Cassou
@ 2020-03-11 17:44 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2020-03-11 17:44 UTC (permalink / raw)
  To: Damien Cassou; +Cc: 39922-done

Hi Damien,

Damien Cassou <damien@cassou.me> skribis:

>>From f6f5ed7f4d5ba8a75f8783a7958b6f73d43644dd Mon Sep 17 00:00:00 2001
> From: Damien Cassou <damien@cassou.me>
> Date: Wed, 4 Mar 2020 16:31:51 +0100
> Subject: [PATCH 1/2] gnu: Add clipnotify.
>
> * gnu/packages/xdisorg.scm (clipnotify): New variable.

Neat!  I added a copyright line for you, let me know if anything’s
wrong!

> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (let* ((out  (assoc-ref outputs "out"))
> +                    (bin  (string-append out "/bin"))
> +                    (doc  (string-append %output "/share/doc/" ,name "-" ,version)))
> +               (install-file "clipnotify" bin)
> +               (install-file "README.md" doc)))))

I added a #t here (by convention, phase have to return either #t or #f
currently.)

>>From 6d3202131236adc7f5c38e07541382d04ac68cf1 Mon Sep 17 00:00:00 2001
> From: Damien Cassou <damien@cassou.me>
> Date: Thu, 5 Mar 2020 08:26:23 +0100
> Subject: [PATCH 2/2] gnu: Add clipmenu.
>
> * gnu/packages/xdisorg.scm (clipmenu): New variable.

[...]

> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'fix-hardcoded-paths
> +                  (lambda _
> +                    (substitute* "clipmenud"
> +                      (("has_clipnotify=0") "has_clipnotify=1")
> +                      (("command -v clipnotify >/dev/null 2>&1 && has_clipnotify=1") "")
> +                      (("clipnotify \\|\\| .*") (string-append (which "clipnotify") "\n"))
> +                      (("xsel --logfile") (string-append (which "xsel") " --logfile")))
> +                    (substitute* "clipmenu"
> +                      (("xsel --logfile") (string-append (which "xsel") " --logfile")))

I adjusted the indentation and line length here.

> +         (replace 'install
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (let* ((out  (assoc-ref outputs "out"))
> +                    (bin  (string-append out "/bin"))
> +                    (doc  (string-append %output "/share/doc/" ,name "-" ,version)))
> +               (install-file "clipdel" bin)
> +               (install-file "clipmenu" bin)
> +               (install-file "clipmenud" bin)
> +               (install-file "README.md" doc)))))

and added #t here.

> +       #:tests? #f))

Oh, I overlooked that, but usually, when disabling tests, we add a
comment explaining why.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-11 17:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-05 10:25 [bug#39922] [PATCH] Add clipnotify and clipmenu Damien Cassou
2020-03-11 17:44 ` bug#39922: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).