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.
69 lines
1.6 KiB
69 lines
1.6 KiB
From b57f6899b277265f19b6ec94d8c476991f452bc7 Mon Sep 17 00:00:00 2001
|
|
From: Michael Buch <michaelbuch12@gmail.com>
|
|
Date: Sat, 2 Feb 2019 15:07:21 +0000
|
|
Subject: [PATCH] 0.8.1 port
|
|
|
|
---
|
|
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 82b1b09..83627db 100644
|
|
--- a/config.def.h
|
|
+++ b/config.def.h
|
|
@@ -178,6 +178,7 @@ static Shortcut shortcuts[] = {
|
|
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
|
|
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
|
|
{ TERMMOD, XK_I, iso14755, {.i = 0} },
|
|
+ { MODKEY, XK_o, opencopied, {.v = "xdg-open"} },
|
|
};
|
|
|
|
/*
|
|
diff --git a/st.h b/st.h
|
|
index dac64d8..762938e 100644
|
|
--- a/st.h
|
|
+++ b/st.h
|
|
@@ -80,6 +80,7 @@ void die(const char *, ...);
|
|
void redraw(void);
|
|
void draw(void);
|
|
|
|
+void opencopied(const Arg *);
|
|
void iso14755(const Arg *);
|
|
void printscreen(const Arg *);
|
|
void printsel(const Arg *);
|
|
diff --git a/x.c b/x.c
|
|
index c343ba2..3dfe122 100644
|
|
--- a/x.c
|
|
+++ b/x.c
|
|
@@ -1950,3 +1950,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\n");
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ /* account for space/quote (3) and \0 (1) and & (1) */
|
|
+ char cmd[max_cmd + strlen(clip) + 5];
|
|
+ strncpy(cmd, (char *)arg->v, max_cmd);
|
|
+ cmd[max_cmd] = '\0';
|
|
+
|
|
+ strcat(cmd, " \"");
|
|
+ strcat(cmd, clip);
|
|
+ strcat(cmd, "\"");
|
|
+ strcat(cmd, "&");
|
|
+
|
|
+ system(cmd);
|
|
+}
|
|
--
|
|
2.20.1
|
|
|
|
|