diff options
author | 2019-11-02 02:24:14 +0100 | |
---|---|---|
committer | 2019-11-02 06:54:14 +0530 | |
commit | 3c1645ca904578a7c43ed8e8e7e264cf99f997da (patch) | |
tree | 96d10efbee412d944f5adb8db446cc2403d03860 /plugins/drag-file | |
parent | 013dad11868df0b389d5ccc87943678abe0bf83e (diff) | |
download | nnn-3c1645ca904578a7c43ed8e8e7e264cf99f997da.tar.gz |
Merged drag and drop scripts to 1 file (#372)
Diffstat (limited to 'plugins/drag-file')
-rwxr-xr-x | plugins/drag-file | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/plugins/drag-file b/plugins/drag-file deleted file mode 100755 index 4bf57ba..0000000 --- a/plugins/drag-file +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env sh - -# Description: Open a Drag and drop window, to drop files onto other programs -# -# Dependency: https://github.com/mwh/dragon -# Shell: POSIX compliant -# Author: 0xACE - -selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection -resp=f -all= - -dnd() -{ - if which dragon-drag-and-drop; then - dragon-drag-and-drop "$@" - else - dragon "$@" - fi -} - -function use_all() -{ - echo -n "mark --all (a) [default=none]: " - read resp - if [ "$resp" = "a" ]; then - all="--all" - else - all="" - fi -} - -if [ -s "$selection" ]; then - echo -n "work with selection (s), current working directory (d) or current file (f) [default=f]: " - read resp -else - echo -n "work with current working directory (d) or current file (f) [default=f]: " - read resp - if [ "$resp" = "s" ]; then - resp=f - fi -fi - -if [ "$resp" = "s" ]; then - use_all - sed -z 's|'"$PWD/"'||g' < "$selection" | xargs -0 dnd "$all" & -elif [ "$resp" = "d" ]; then - use_all - dnd "$all" "$PWD/"* & -else - if [ -n "$1" ] && [ -e "$1" ]; then - dnd "$1" & - fi -fi |