diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/copynpaste.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
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,8 +407,16 @@ 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); } |