My build of nnn with minor changes
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

launch 1.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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