diff options
author | 0xACE <0xACE@users.noreply.github.com> | 2019-11-15 16:27:37 +0000 |
---|---|---|
committer | Mischievous Meerkat <engineerarun@gmail.com> | 2019-11-15 21:57:37 +0530 |
commit | 688ed885d1edfbc2cb228cac53955d72c6521e81 (patch) | |
tree | 53bcada280ab04f0a0c7091c33978853407e09c0 /plugins | |
parent | 950a8f6a6560f32a5f8737922e03c7bc0bdc9bd5 (diff) | |
download | nnn-688ed885d1edfbc2cb228cac53955d72c6521e81.tar.gz |
Fix dragdrop not working in selection mode (#382)
xargs couldn't call function `dnd()` and I couldn't find a portable way
to do it, so I replaced it with a variable which I guess should work
fine.
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/dragdrop | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/plugins/dragdrop b/plugins/dragdrop index 647e848..47b325c 100755 --- a/plugins/dragdrop +++ b/plugins/dragdrop @@ -16,15 +16,11 @@ selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection resp=f all= - -dnd() -{ - if which dragon-drag-and-drop 2>&1 >/dev/null; then - dragon-drag-and-drop "$@" 2>/dev/null - else - dragon "$@" 2>/dev/null - fi -} +if which dragon-drag-and-drop 2>&1 >/dev/null; then + dnd="dragon-drag-and-drop" +else + dnd="dragon" +fi function add_file() { echo -n "$@" >> "$selection" @@ -55,13 +51,13 @@ fi if [ "$resp" = "s" ]; then use_all - sed -z 's|'"$PWD/"'||g' < "$selection" | xargs -0 dnd "$all" & + sed -z 's|'"$PWD/"'||g' < "$selection" | xargs -0 "$dnd" "$all" & elif [ "$resp" = "d" ]; then use_all - dnd "$all" "$PWD/"* & + "$dnd" "$all" "$PWD/"* & elif [ "$resp" = "r" ]; then echo -n > "$selection" - dnd --print-path --target | while read f + "$dnd" --print-path --target | while read f do if echo -n "$f" | grep '^\(https\?\|ftps\?\|s\?ftp\):\/\/' ; then curl -LJO "$f" @@ -72,7 +68,7 @@ elif [ "$resp" = "r" ]; then done & else if [ -n "$1" ] && [ -e "$1" ]; then - dnd "$1" & + "$dnd" "$1" & fi fi |