[wiki] [sites] Added surf clipboard-instead-of-primary patch || Olivier Moreau

From: <git_AT_suckless.org>
Date: Sun, 12 Jan 2020 11:56:16 +0100

commit f3414dc2fd182b91c3582fb9d3b189b23b93597c
Author: Olivier Moreau <m242_AT_protonmail.com>
Date: Sun Jan 12 11:55:49 2020 +0000

    Added surf clipboard-instead-of-primary patch

diff --git a/surf.suckless.org/patches/clipboard-instead-of-primary/index.md b/surf.suckless.org/patches/clipboard-instead-of-primary/index.md
new file mode 100644
index 00000000..9fd52229
--- /dev/null
+++ b/surf.suckless.org/patches/clipboard-instead-of-primary/index.md
_AT_@ -0,0 +1,18 @@
+Use the GTK clipboard instead of primary selection
+==================================================
+
+Description
+-----------
+
+By default surf's clipboard function access the PRIMARY gtk selection.
+This patch adds a config option (ClipboardNotPrimary) that allows to use the CLIPBOARD selection.
+
+Download
+--------
+
+* [surf-clipboard-20200112-a6a8878.diff](surf-clipboard-20200112-a6a8878.diff) (1.9k)
+
+Author
+------
+
+* m242 - <m242_AT_protonmail.com>
\ No newline at end of file
diff --git a/surf.suckless.org/patches/clipboard-instead-of-primary/surf-clipboard-20200112-a6a8878.diff b/surf.suckless.org/patches/clipboard-instead-of-primary/surf-clipboard-20200112-a6a8878.diff
new file mode 100644
index 00000000..5c43025b
--- /dev/null
+++ b/surf.suckless.org/patches/clipboard-instead-of-primary/surf-clipboard-20200112-a6a8878.diff
_AT_@ -0,0 +1,67 @@
+From a6a8878bb6a203b589d559025b94a78214f22878 Mon Sep 17 00:00:00 2001
+From: Olivier Moreau <m242_AT_protonmail.com>
+Date: Sun, 12 Jan 2020 11:23:11 +0000
+Subject: [PATCH] Added choice between PRIMARY and CLIPBOARD Gtk selections, as
+ a config option
+
+---
+ config.def.h | 1 +
+ surf.c | 11 +++++++++--
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 34265f6..03bbe2b 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -48,6 +48,7 @@ static Parameter defconfig[ParameterLast] = {
+ [Style] = { { .i = 1 }, },
+ [WebGL] = { { .i = 0 }, },
+ [ZoomLevel] = { { .f = 1.0 }, },
++ [ClipboardNotPrimary] = { { .i = 1 }, },
+ };
+
+ static UriParameters uriparams[] = {
+diff --git a/surf.c b/surf.c
+index 2b54e3c..b8a9b2f 100644
+--- a/surf.c
++++ b/surf.c
+_AT_@ -82,6 +82,7 @@ typedef enum {
+ Style,
+ WebGL,
+ ZoomLevel,
++ ClipboardNotPrimary,
+ ParameterLast
+ } ParamName;
+
+_AT_@ -291,6 +292,7 @@ static ParamName loadcommitted[] = {
+ SpellLanguages,
+ Style,
+ ZoomLevel,
++ ClipboardNotPrimary,
+ ParameterLast
+ };
+
+_AT_@ -1816,13 +1818,18 @@ showcert(Client *c, const Arg *a)
+ void
+ clipboard(Client *c, const Arg *a)
+ {
++ /* User defined choice of selection, see config.h */
++ GdkAtom selection = GDK_SELECTION_PRIMARY;
++ if (curconfig[ClipboardNotPrimary].val.i > 0)
++ selection = GDK_SELECTION_CLIPBOARD;
++
+ if (a->i) { /* load clipboard uri */
+ gtk_clipboard_request_text(gtk_clipboard_get(
+- GDK_SELECTION_PRIMARY),
++ selection),
+ pasteuri, c);
+ } else { /* copy uri */
+ gtk_clipboard_set_text(gtk_clipboard_get(
+- GDK_SELECTION_PRIMARY), c->targeturi
++ selection), c->targeturi
+ ? c->targeturi : geturi(c), -1);
+ }
+ }
+--
+2.24.1
+
Received on Sun Jan 12 2020 - 11:56:16 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 12 2020 - 12:00:31 CET