nnn/misc/nlaunch/nlaunch

30 lines
664 B
Plaintext
Raw Normal View History

#!/usr/bin/env sh
2019-03-23 15:30:16 +00:00
# Description: Fuzzy find executables in $PATH and launch an application.
# stdin, stdout, stderr are suppressed so CLI utilities exit silently.
# Works as an independent app launcher.
#
2019-04-18 14:11:39 +00:00
# Requires fzy.
#
2019-04-28 15:18:14 +00:00
# Usage: nlaunch [delay]
# delay is in seconds, if omitted nlaunch waits for 1 sec
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
IFS=':'
get_selection() {
ls -H $PATH | sort | fzy
}
if selection=$( get_selection ); then
2019-04-26 13:38:04 +00:00
setsid "$selection" 2>/dev/null 1>/dev/null &
2019-04-28 15:18:14 +00:00
if ! [ -z "$1" ]; then
sleep "$1"
else
sleep 1
fi
fi