diff options
author | 2019-06-16 22:21:13 +0530 | |
---|---|---|
committer | 2019-06-17 07:04:42 +0530 | |
commit | 794a0e27091b63f997fc829d0288cde5a4a2edbd (patch) | |
tree | 384695218b8cf09700df81715627004124e0edf7 /misc/nlaunch | |
parent | aa56b99326a12f5bbab6d5a693755060e81e44a2 (diff) | |
download | nnn-794a0e27091b63f997fc829d0288cde5a4a2edbd.tar.gz |
Move scripts to misc
Diffstat (limited to 'misc/nlaunch')
-rw-r--r-- | misc/nlaunch/README.md | 7 | ||||
-rwxr-xr-x | misc/nlaunch/nlaunch | 29 |
2 files changed, 36 insertions, 0 deletions
diff --git a/misc/nlaunch/README.md b/misc/nlaunch/README.md new file mode 100644 index 0000000..2b267ee --- /dev/null +++ b/misc/nlaunch/README.md @@ -0,0 +1,7 @@ +`nlaunch` is an independent POSIX-compliant GUI application launcher shell script. To use it with `nnn` you need to mark the file executable and drop it somewhere in your `$PATH`. + +It requires [`fzy`](https://github.com/jhawthorn/fzy) to show a fuzzy drop-down menu. + +To use `nlaunch` as an independent launcher add a keybind to open `nlaunch` in a terminal e.g. + + xfce4-terminal -e nlaunch diff --git a/misc/nlaunch/nlaunch b/misc/nlaunch/nlaunch new file mode 100755 index 0000000..123e62d --- /dev/null +++ b/misc/nlaunch/nlaunch @@ -0,0 +1,29 @@ +#!/usr/bin/env sh + +# 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. +# +# Requires fzy. +# +# 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 + setsid "$selection" 2>/dev/null 1>/dev/null & + + if ! [ -z "$1" ]; then + sleep "$1" + else + sleep 1 + fi +fi |