Browse Source

use clipboard instead of primary selection

surf-webkit2
odrling 2 years ago
parent
commit
81c157f7c8
  1. 1
      config.def.h
  2. 11
      surf.c

1
config.def.h

@ -48,6 +48,7 @@ static Parameter defconfig[ParameterLast] = {
[Style] = { { .i = 1 }, },
[WebGL] = { { .i = 0 }, },
[ZoomLevel] = { { .f = 1.0 }, },
[ClipboardNotPrimary] = { { .i = 1 }, },
};
static UriParameters uriparams[] = {

11
surf.c

@ -82,6 +82,7 @@ typedef enum {
Style,
WebGL,
ZoomLevel,
ClipboardNotPrimary,
ParameterLast
} ParamName;
@ -292,6 +293,7 @@ static ParamName loadcommitted[] = {
SpellLanguages,
Style,
ZoomLevel,
ClipboardNotPrimary,
ParameterLast
};
@ -1817,13 +1819,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);
}
}

Loading…
Cancel
Save