---- - config.def.h | 1 + - st.h | 1 + - x.c | 23 +++++++++++++++++++++++ - 3 files changed, 25 insertions(+) - -diff --git a/config.def.h b/config.def.h -index 823e79f..fcd0101 100644 ---- a/config.def.h -+++ b/config.def.h -_AT_@ -177,6 +177,7 @@ static Shortcut shortcuts[] = { - { TERMMOD, XK_V, clippaste, {.i = 0} }, - { TERMMOD, XK_Y, selpaste, {.i = 0} }, - { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, -+ { MODKEY, XK_o, opencopied, {.v = "xdg-open"} }, - }; - - /* -diff --git a/st.h b/st.h -index 38c61c4..a0d7a83 100644 ---- a/st.h -+++ b/st.h -_AT_@ -80,6 +80,7 @@ void die(const char *, ...); - void redraw(void); - void draw(void); - -+void opencopied(const Arg *); - void printscreen(const Arg *); - void printsel(const Arg *); - void sendbreak(const Arg *); -diff --git a/x.c b/x.c -index 0422421..6a5ef48 100644 ---- a/x.c -+++ b/x.c -_AT_@ -1953,3 +1953,26 @@ run: - - return 0; - } -+ -+void -+opencopied(const Arg *arg) -+{ -+ const size_t max_cmd = 2048; -+ const char *clip = xsel.clipboard; -+ if(!clip) { -+ fprintf(stderr, "Warning: nothing copied to clipboard "); -+ return; -+ } -+ -+ /* account for space/quote (3) and -+ char cmd[max_cmd + strlen(clip) + 4]; -+ strncpy(cmd, (char *)arg->v, max_cmd); -+ cmd[max_cmd] = '-+ -+ strcat(cmd, " \""); -+ strcat(cmd, clip); -+ strcat(cmd, "\""); -+ strcat(cmd, " &"); -+ -+ system(cmd); -+} --- -2.20.1 - diff --git a/st.suckless.org/patches/open_copied_url/st-openclipboard-20180525-2c2500c.diff b/st.suckless.org/patches/open_copied_url/st-openclipboard-20190202-0.8.1.diff similarity index 62% rename from st.suckless.org/patches/open_copied_url/st-openclipboard-20180525-2c2500c.diff rename to st.suckless.org/patches/open_copied_url/st-openclipboard-20190202-0.8.1.diff index 88aea1e4..bdea09a0 100644 --- a/st.suckless.org/patches/open_copied_url/st-openclipboard-20180525-2c2500c.diff +++ b/st.suckless.org/patches/open_copied_url/st-openclipboard-20190202-0.8.1.diff _AT_@ -1,18 +1,13 @@ -From 2c2500c057433148c49465b9d009193ffcef6432 Mon Sep 17 00:00:00 2001 +From b57f6899b277265f19b6ec94d8c476991f452bc7 Mon Sep 17 00:00:00 2001 From: Michael Buch <michaelbuch12_AT_gmail.com> -Date: Fri, 25 May 2018 00:02:40 +0100 -Subject: [PATCH] [st patch] Add ability to open clipboard with configured - program +Date: Sat, 2 Feb 2019 15:07:21 +0000 +Subject: [PATCH] 0.8.1 port -Lets user define a program to run in config.h and uses contents -of CLIPBOARD selection to pass as a parameter. This can be bound -to any key. By default binds Mod+o to opening the default -browser. --- config.def.h | 1 + st.h | 1 + - x.c | 22 ++++++++++++++++++++++ - 3 files changed, 24 insertions(+) + x.c | 23 +++++++++++++++++++++++ + 3 files changed, 25 insertions(+) diff --git a/config.def.h b/config.def.h index 82b1b09..83627db 100644 _AT_@ -27,22 +22,22 @@ index 82b1b09..83627db 100644 /* diff --git a/st.h b/st.h -index dac64d8..773eeb3 100644 +index dac64d8..762938e 100644 --- a/st.h +++ b/st.h -_AT_@ -81,6 +81,7 @@ void redraw(void); +_AT_@ -80,6 +80,7 @@ void die(const char *, ...); + void redraw(void); void draw(void); - void iso14755(const Arg *); +void opencopied(const Arg *); + void iso14755(const Arg *); void printscreen(const Arg *); void printsel(const Arg *); - void sendbreak(const Arg *); diff --git a/x.c b/x.c -index c0bd890..b7edc5e 100644 +index c343ba2..3dfe122 100644 --- a/x.c +++ b/x.c -_AT_@ -1949,3 +1949,25 @@ run: +_AT_@ -1950,3 +1950,26 @@ run: return 0; } _AT_@ -57,17 +52,18 @@ index c0bd890..b7edc5e 100644 + return; + } + -+ /* account for space/quote (3) and -+ char cmd[max_cmd + strlen(clip) + 4]; ++ /* account for space/quote (3) and ++ char cmd[max_cmd + strlen(clip) + 5]; + strncpy(cmd, (char *)arg->v, max_cmd); + cmd[max_cmd] = ' + + strcat(cmd, " \""); + strcat(cmd, clip); + strcat(cmd, "\""); ++ strcat(cmd, "&"); + + system(cmd); +} -- -2.17.0 +2.20.1 diff --git a/st.suckless.org/patches/open_copied_url/st-openclipboard-20190202-3be4cf1.diff b/st.suckless.org/patches/open_copied_url/st-openclipboard-20190202-3be4cf1.diff new file mode 100644 index 00000000..5c9dd465 --- /dev/null +++ b/st.suckless.org/patches/open_copied_url/st-openclipboard-20190202-3be4cf1.diff _AT_@ -0,0 +1,65 @@ +From 8a3e3d9f0de95c55321761e2763cf43666da312d Mon Sep 17 00:00:00 2001 +From: Michael Buch <michaelbuch12_AT_gmail.com> +Date: Sat, 2 Feb 2019 14:52:56 +0000 +Subject: [PATCH] Add ability to open clipboard with configured program + +--- + config.def.h | 1 + + st.h | 1 + + x.c | 19 +++++++++++++++++++ + 3 files changed, 21 insertions(+) + +diff --git a/config.def.h b/config.def.h +index 0e01717..c273252 100644 +--- a/config.def.h ++++ b/config.def.h +_AT_@ -178,6 +178,7 @@ static Shortcut shortcuts[] = { + { TERMMOD, XK_Y, selpaste, {.i = 0} }, + { ShiftMask, XK_Insert, selpaste, {.i = 0} }, + { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, ++ { MODKEY, XK_o, opencopied, {.v = "xdg-open"} }, + }; + + /* +diff --git a/st.h b/st.h +index 38c61c4..a0d7a83 100644 +--- a/st.h ++++ b/st.h +_AT_@ -80,6 +80,7 @@ void die(const char *, ...); + void redraw(void); + void draw(void); + ++void opencopied(const Arg *); + void printscreen(const Arg *); + void printsel(const Arg *); + void sendbreak(const Arg *); +diff --git a/x.c b/x.c +index 0422421..af75e85 100644 +--- a/x.c ++++ b/x.c +_AT_@ -1953,3 +1953,22 @@ run: + + return 0; + } ++ ++void ++opencopied(const Arg *arg) ++{ ++ size_t const max_cmd = 2048; ++ char * const clip = xsel.clipboard; ++ if(!clip) { ++ fprintf(stderr, "Warning: nothing copied to clipboard "); ++ return; ++ } ++ ++ /* account for space/quote (3) and ++ /* e.g.: xdg-open "https://st.suckless.org"& */ ++ size_t const cmd_size = max_cmd + strlen(clip) + 5; ++ char cmd[cmd_size]; ++ ++ snprintf(cmd, cmd_size, "%s \"%s\"&", (char *)arg->v, clip); ++ system(cmd); ++} +-- +2.20.1 +Received on Sat Feb 02 2019 - 16:09:30 CET
This archive was generated by hypermail 2.3.0 : Sat Feb 02 2019 - 16:12:26 CET