My build of nnn with minor changes
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

drag-file 1.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env sh
  2. # Description: Open a Drag and drop window, to drop files onto other programs
  3. #
  4. # Dependency: https://github.com/mwh/dragon
  5. # Shell: POSIX compliant
  6. # Author: 0xACE
  7. selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
  8. resp=f
  9. all=
  10. dnd()
  11. {
  12. if which dragon-drag-and-drop; then
  13. dragon-drag-and-drop "$@"
  14. else
  15. dragon "$@"
  16. fi
  17. }
  18. function use_all()
  19. {
  20. echo -n "mark --all (a) [default=none]: "
  21. read resp
  22. if [ "$resp" = "a" ]; then
  23. all="--all"
  24. else
  25. all=""
  26. fi
  27. }
  28. if [ -s "$selection" ]; then
  29. echo -n "work with selection (s), current working directory (d) or current file (f) [default=f]: "
  30. read resp
  31. else
  32. echo -n "work with current working directory (d) or current file (f) [default=f]: "
  33. read resp
  34. if [ "$resp" = "s" ]; then
  35. resp=f
  36. fi
  37. fi
  38. if [ "$resp" = "s" ]; then
  39. use_all
  40. sed -z 's|'"$PWD/"'||g' < "$selection" | xargs -0 dnd "$all" &
  41. elif [ "$resp" = "d" ]; then
  42. use_all
  43. dnd "$all" "$PWD/"* &
  44. else
  45. if [ -n "$1" ] && [ -e "$1" ]; then
  46. dnd "$1" &
  47. fi
  48. fi