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.
 
 
 
 
 
 

43 lines
1.1 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. # Requires: fzf or fzy
  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. IFS=':'
  21. get_selection() {
  22. if which fzf >/dev/null 2>&1; then
  23. ls -H $PATH | sort | fzf
  24. elif which fzy >/dev/null 2>&1; then
  25. ls -H $PATH | sort | fzy
  26. else
  27. exit 1
  28. fi
  29. }
  30. if selection=$( get_selection ); then
  31. setsid "$selection" 2>/dev/null 1>/dev/null &
  32. if ! [ -z "$1" ]; then
  33. sleep "$1"
  34. else
  35. sleep 1
  36. fi
  37. fi