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.
 
 
 
 
 
 

43 lignes
1.0 KiB

  1. #!/usr/bin/env sh
  2. # Description: Independent POSIX-compliant GUI application launcher.
  3. # Fuzzy find executables in $PATH and launch an application.
  4. # stdin, stdout, stderr are suppressed so CLI tools exit silently.
  5. #
  6. # To configure launch as an independent app launcher add a keybind
  7. # to open launch in a terminal e.g.,
  8. #
  9. # xfce4-terminal -e "${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/launch
  10. #
  11. # Dependencies: fzf
  12. #
  13. # Usage: launch [delay]
  14. # delay is in seconds, if omitted launch waits for 1 sec
  15. #
  16. # Integration with nnn: launch is installed with other plugins, nnn picks it up.
  17. #
  18. # Shell: POSIX compliant
  19. # Author: Arun Prakash Jana
  20. # shellcheck disable=SC2086
  21. IFS=':'
  22. get_selection() {
  23. if which fzf >/dev/null 2>&1; then
  24. { IFS=':'; ls -H $PATH; } | sort | fzf
  25. else
  26. exit 1
  27. fi
  28. }
  29. if selection=$( get_selection ); then
  30. setsid "$selection" 2>/dev/null 1>/dev/null &
  31. if [ -n "$1" ]; then
  32. sleep "$1"
  33. else
  34. sleep 1
  35. fi
  36. fi