diff --git a/README.md b/README.md
index dcb259c..8f44c2e 100644
--- a/README.md
+++ b/README.md
@@ -50,9 +50,12 @@ binding in copy mode. In `v2.0.0` this key binding was changed to `Y` (shift-y).
#### Cygwin requirements
-- `putclip` command
- Get the command by installing `cygutils-extra` package with Cygwin's
- `setup*.exe`.
+- None!
+ Now supports cygwin builtin /dev/clipboard.
+ Support still exists for the following if desired:
+ - `putclip` command
+ Get the command by installing `cygutils-extra` package with Cygwin's
+ `setup*.exe`.
### Notes
diff --git a/scripts/helpers.sh b/scripts/helpers.sh
index 88fff4f..92d0119 100644
--- a/scripts/helpers.sh
+++ b/scripts/helpers.sh
@@ -110,14 +110,16 @@ clipboard_copy_command() {
else
echo "pbcopy"
fi
- elif command_exists "xclip"; then
+ elif command_exists "xclip" && [ -n "$DISPLAY" ]; then # only works if $DISPLAY set
local xclip_selection="$(yank_selection)"
echo "xclip -selection $xclip_selection"
- elif command_exists "xsel"; then
+ elif command_exists "xsel" && [ -n "$DISPLAY" ]; then # also required $DISPLAY
local xsel_selection="$(yank_selection)"
echo "xsel -i --$xsel_selection"
elif command_exists "putclip"; then # cygwin clipboard command
echo "putclip"
+ elif [ "$OSTYPE" == "cygwin" ]; then # cygwin fall back to built-in /dev/clipboard
+ echo "cat > /dev/clipboard"
elif [ -n "$(custom_copy_command)" ]; then
echo "$(custom_copy_command)"
fi