From ba48d311209a535acd3610c70845806bbf675c15 Mon Sep 17 00:00:00 2001 From: "Matt Hayden (Innolitics)" Date: Thu, 21 Mar 2019 11:16:29 -0600 Subject: [PATCH] Support for Windows Subsystem for Linux clipboard command --- src/sysclip.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/sysclip.cc b/src/sysclip.cc index 3b5250f3..e4f252c3 100644 --- a/src/sysclip.cc +++ b/src/sysclip.cc @@ -48,6 +48,11 @@ static clip_command *get_commands() { { "pbcopy -pboard find > /dev/null 2>&1", "pbpaste -pboard find -Prefer txt 2>/dev/null" } }, }; + static clip_command WINDOWS_CMDS[] = { + { { "clip.exe > /dev/null 2>&1", + nullptr } }, + { { nullptr, nullptr } }, + }; static clip_command X_CMDS[] = { { { "xclip -i > /dev/null 2>&1", "xclip -o < /dev/null 2>/dev/null" } }, @@ -59,6 +64,12 @@ static clip_command *get_commands() if (system("which xclip > /dev/null 2>&1") == 0) { return X_CMDS; } + /* + * xclip and clip.exe may coexist on Windows Subsystem for Linux + */ + if (system("which clip.exe > /dev/null 2>&1") == 0) { + return WINDOWS_CMDS; + } return nullptr; }