summaryrefslogtreecommitdiff
path: root/mut/surf
diff options
context:
space:
mode:
authorMike Vink <59492084+ivi-vink@users.noreply.github.com>2025-01-18 21:25:25 +0000
committerMike Vink <59492084+ivi-vink@users.noreply.github.com>2025-01-19 12:39:25 +0000
commit0f6de348ad935de38cadd10bde68515c63595836 (patch)
tree2509f64255570f9938c8ab469a1ec11d516d247f /mut/surf
parent75f4f4542766191f9597d48dfc726bdc269b1a89 (diff)
fixup
Diffstat (limited to 'mut/surf')
-rw-r--r--mut/surf/config.def.h13
-rw-r--r--mut/surf/surf.c11
2 files changed, 21 insertions, 3 deletions
diff --git a/mut/surf/config.def.h b/mut/surf/config.def.h
index ef44721..1d27a0e 100644
--- a/mut/surf/config.def.h
+++ b/mut/surf/config.def.h
@@ -47,6 +47,7 @@ static Parameter defconfig[ParameterLast] = {
[Style] = { { .i = 1 }, },
[WebGL] = { { .i = 0 }, },
[ZoomLevel] = { { .f = 1.0 }, },
+ [ClipboardNotPrimary] = { { .i = 1 }, },
};
static UriParameters uriparams[] = {
@@ -100,6 +101,14 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
} \
}
+#define SR_SEARCH {\
+ .v = (char *[]){\
+ "/bin/sh", "-c", "xprop -id $0 -f _SURF_GO 8s -set _SURF_GO $(sr -p $(sr -elvi | tail -n +2 | cut -s -f1 | dmenu))", \
+ winid, \
+ NULL \
+ } \
+}
+
/* styles */
/*
* The iteration will stop at the first match, beginning at the beginning of
@@ -132,8 +141,10 @@ static Key keys[] = {
{ MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
+ { MODKEY, GDK_KEY_s, spawn, SR_SEARCH },
+
{ 0, GDK_KEY_Escape, stop, { 0 } },
- { MODKEY, GDK_KEY_c, stop, { 0 } },
+ /* { MODKEY, GDK_KEY_c, stop, { 0 } }, */
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
{ MODKEY, GDK_KEY_r, reload, { .i = 0 } },
diff --git a/mut/surf/surf.c b/mut/surf/surf.c
index bcd8d6a..d0ab984 100644
--- a/mut/surf/surf.c
+++ b/mut/surf/surf.c
@@ -83,6 +83,7 @@ typedef enum {
Style,
WebGL,
ZoomLevel,
+ ClipboardNotPrimary,
ParameterLast
} ParamName;
@@ -291,6 +292,7 @@ static ParamName loadcommitted[] = {
SpellLanguages,
Style,
ZoomLevel,
+ ClipboardNotPrimary,
ParameterLast
};
@@ -1827,13 +1829,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);
}
}