Merge pull request #627 from matt-hayden/master

Support for Windows Subsystem for Linux clipboard command
This commit is contained in:
Tim Stack 2019-03-21 22:14:56 -07:00 committed by GitHub
commit 776705e90e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -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;
}