From 50a25d4209c4412bbe6632baabeb931694d8ed25 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 Dec 2011 22:31:27 +0300 Subject: Add pasting into two clipboards under xserver. --- src/utils/copynpaste.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/utils/copynpaste.cpp') diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index 784870e05..5105d38e5 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -407,7 +407,15 @@ bool retrieveBuffer(std::string& text, std::string::size_type& pos) return false; } +bool runxsel(std::string& text, const char *p1, const char *p2 = nullptr); + bool sendBuffer(std::string& text) +{ + runxsel(text, "-i"); + runxsel(text, "-b", "-i"); +} + +bool runxsel(std::string& text, const char *p1, const char *p2) { pid_t pid; int fd[2]; @@ -432,7 +440,11 @@ bool sendBuffer(std::string& text) } close(fd[0]); } - execl("/usr/bin/xsel", "xsel", "-b", "-i", (char *)nullptr); + if (p2) + execl("/usr/bin/xsel", "xsel", p1, p2, (char *)nullptr); + else + execl("/usr/bin/xsel", "xsel", p1, (char *)nullptr); + exit(1); } -- cgit v1.2.3-60-g2f50