applied bookmarking and clipboard instead of primary
This commit is contained in:
parent
4bf272c8fc
commit
4d0f11a154
18
config.def.h
18
config.def.h
|
@ -54,6 +54,7 @@ static Parameter defconfig[ParameterLast] = {
|
||||||
[Style] = { { .i = 1 }, },
|
[Style] = { { .i = 1 }, },
|
||||||
[WebGL] = { { .i = 0 }, },
|
[WebGL] = { { .i = 0 }, },
|
||||||
[ZoomLevel] = { { .f = 1.0 }, },
|
[ZoomLevel] = { { .f = 1.0 }, },
|
||||||
|
[ClipboardNotPrimary] = { { .i = 1 }, },
|
||||||
};
|
};
|
||||||
|
|
||||||
static UriParameters uriparams[] = {
|
static UriParameters uriparams[] = {
|
||||||
|
@ -76,8 +77,9 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
|
||||||
#define SETPROP(r, s, p) { \
|
#define SETPROP(r, s, p) { \
|
||||||
.v = (const char *[]){ "/bin/sh", "-c", \
|
.v = (const char *[]){ "/bin/sh", "-c", \
|
||||||
"prop=\"$(printf '%b' \"$(xprop -id $1 $2 " \
|
"prop=\"$(printf '%b' \"$(xprop -id $1 $2 " \
|
||||||
"| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\")\" " \
|
"| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\" && cat ~/suckless/surf/bookmarks)\" " \
|
||||||
"| dmenu -p \"$4\" -w $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
|
"| dmenu -l 10 -p \"$4\" -w $1)\" && " \
|
||||||
|
"xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
|
||||||
"surf-setprop", winid, r, s, p, NULL \
|
"surf-setprop", winid, r, s, p, NULL \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
@ -108,6 +110,17 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* BM_ADD(readprop) */
|
||||||
|
#define BM_ADD(r) {\
|
||||||
|
.v = (const char *[]){ "/bin/sh", "-c", \
|
||||||
|
"(echo $(xprop -id $0 $1) | cut -d '\"' -f2 " \
|
||||||
|
"| sed 's/.*https*:\\/\\/\\(www\\.\\)\\?//' && cat ~/suckless/surf/bookmarks) " \
|
||||||
|
"| awk '!seen[$0]++' > ~/suckless/surf/bookmarks.tmp && " \
|
||||||
|
"mv ~/suckless/surf/bookmarks.tmp ~/suckless/surf/bookmarks", \
|
||||||
|
winid, r, NULL \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
/* styles */
|
/* styles */
|
||||||
/*
|
/*
|
||||||
* The iteration will stop at the first match, beginning at the beginning of
|
* The iteration will stop at the first match, beginning at the beginning of
|
||||||
|
@ -139,6 +152,7 @@ static Key keys[] = {
|
||||||
{ MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
|
{ MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
|
||||||
{ MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
|
{ 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_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
|
||||||
|
{ MODKEY, GDK_KEY_m, spawn, BM_ADD("_SURF_URI") },
|
||||||
|
|
||||||
{ 0, GDK_KEY_Escape, stop, { 0 } },
|
{ 0, GDK_KEY_Escape, stop, { 0 } },
|
||||||
{ MODKEY, GDK_KEY_c, stop, { 0 } },
|
{ MODKEY, GDK_KEY_c, stop, { 0 } },
|
||||||
|
|
11
surf.c
11
surf.c
|
@ -83,6 +83,7 @@ typedef enum {
|
||||||
Style,
|
Style,
|
||||||
WebGL,
|
WebGL,
|
||||||
ZoomLevel,
|
ZoomLevel,
|
||||||
|
ClipboardNotPrimary,
|
||||||
ParameterLast
|
ParameterLast
|
||||||
} ParamName;
|
} ParamName;
|
||||||
|
|
||||||
|
@ -293,6 +294,7 @@ static ParamName loadcommitted[] = {
|
||||||
SpellLanguages,
|
SpellLanguages,
|
||||||
Style,
|
Style,
|
||||||
ZoomLevel,
|
ZoomLevel,
|
||||||
|
ClipboardNotPrimary,
|
||||||
ParameterLast
|
ParameterLast
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1842,13 +1844,18 @@ showcert(Client *c, const Arg *a)
|
||||||
void
|
void
|
||||||
clipboard(Client *c, const Arg *a)
|
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 */
|
if (a->i) { /* load clipboard uri */
|
||||||
gtk_clipboard_request_text(gtk_clipboard_get(
|
gtk_clipboard_request_text(gtk_clipboard_get(
|
||||||
GDK_SELECTION_PRIMARY),
|
selection),
|
||||||
pasteuri, c);
|
pasteuri, c);
|
||||||
} else { /* copy uri */
|
} else { /* copy uri */
|
||||||
gtk_clipboard_set_text(gtk_clipboard_get(
|
gtk_clipboard_set_text(gtk_clipboard_get(
|
||||||
GDK_SELECTION_PRIMARY), c->targeturi
|
selection), c->targeturi
|
||||||
? c->targeturi : geturi(c), -1);
|
? c->targeturi : geturi(c), -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user