Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.9 KiB

  1. From a6a8878bb6a203b589d559025b94a78214f22878 Mon Sep 17 00:00:00 2001
  2. From: Olivier Moreau <m242@protonmail.com>
  3. Date: Sun, 12 Jan 2020 11:23:11 +0000
  4. Subject: [PATCH] Added choice between PRIMARY and CLIPBOARD Gtk selections, as
  5. a config option
  6. ---
  7. config.def.h | 1 +
  8. surf.c | 11 +++++++++--
  9. 2 files changed, 10 insertions(+), 2 deletions(-)
  10. diff --git a/config.def.h b/config.def.h
  11. index 34265f6..03bbe2b 100644
  12. --- a/config.def.h
  13. +++ b/config.def.h
  14. @@ -48,6 +48,7 @@ static Parameter defconfig[ParameterLast] = {
  15. [Style] = { { .i = 1 }, },
  16. [WebGL] = { { .i = 0 }, },
  17. [ZoomLevel] = { { .f = 1.0 }, },
  18. + [ClipboardNotPrimary] = { { .i = 1 }, },
  19. };
  20. static UriParameters uriparams[] = {
  21. diff --git a/surf.c b/surf.c
  22. index 2b54e3c..b8a9b2f 100644
  23. --- a/surf.c
  24. +++ b/surf.c
  25. @@ -82,6 +82,7 @@ typedef enum {
  26. Style,
  27. WebGL,
  28. ZoomLevel,
  29. + ClipboardNotPrimary,
  30. ParameterLast
  31. } ParamName;
  32. @@ -291,6 +292,7 @@ static ParamName loadcommitted[] = {
  33. SpellLanguages,
  34. Style,
  35. ZoomLevel,
  36. + ClipboardNotPrimary,
  37. ParameterLast
  38. };
  39. @@ -1816,13 +1818,18 @@ showcert(Client *c, const Arg *a)
  40. void
  41. clipboard(Client *c, const Arg *a)
  42. {
  43. + /* User defined choice of selection, see config.h */
  44. + GdkAtom selection = GDK_SELECTION_PRIMARY;
  45. + if (curconfig[ClipboardNotPrimary].val.i > 0)
  46. + selection = GDK_SELECTION_CLIPBOARD;
  47. +
  48. if (a->i) { /* load clipboard uri */
  49. gtk_clipboard_request_text(gtk_clipboard_get(
  50. - GDK_SELECTION_PRIMARY),
  51. + selection),
  52. pasteuri, c);
  53. } else { /* copy uri */
  54. gtk_clipboard_set_text(gtk_clipboard_get(
  55. - GDK_SELECTION_PRIMARY), c->targeturi
  56. + selection), c->targeturi
  57. ? c->targeturi : geturi(c), -1);
  58. }
  59. }
  60. --
  61. 2.24.1