aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/nlay
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-06-16 22:21:13 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-06-17 07:04:42 +0530
commit794a0e27091b63f997fc829d0288cde5a4a2edbd (patch)
tree384695218b8cf09700df81715627004124e0edf7 /scripts/nlay
parentaa56b99326a12f5bbab6d5a693755060e81e44a2 (diff)
downloadnnn-794a0e27091b63f997fc829d0288cde5a4a2edbd.tar.gz
Move scripts to misc
Diffstat (limited to 'scripts/nlay')
-rw-r--r--scripts/nlay/README.md31
-rwxr-xr-xscripts/nlay/nlay105
-rw-r--r--scripts/nlay/nlay.137
3 files changed, 0 insertions, 173 deletions
diff --git a/scripts/nlay/README.md b/scripts/nlay/README.md
deleted file mode 100644
index 4671eec..0000000
--- a/scripts/nlay/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-## nlay
-
-`nlay` (*NnnpLAY*) is a customizable media type or action handler
-
-### Usage
-
-`nlay` is not used by `nnn` now. However, the bash script can be used to run desktop search utility or screensaver:
-
- nlay file type
- file: absolute path to file ("" for an action)
- type: type of media or action
-
-### Default apps
-
-* gnome-search-tool, catfish - file search
-* vlock - terminal screensaver (alternatives - cmatrix, termsaver)
-
-### Perks
-
-- simple to modify (extensive in-file notes, comments and indicative code)
-- handle files by category (e.g. plaintext, search, screensaver)
-- support for multiple apps by order of preference
-- run app in the foreground or silently detached in the background
-- optionally add app arguments
-
-### Tips to modify
-
-- set `app=` in any category to change the player
-- set `opts=` to use app options
-- toggle `bg=` to enable or disable running app silently (`stdout` and `stderr` redirected to `/dev/null`) in background. E.g., vim (CLI) should be verbose and in the foreground while Sublime Text (GUI) can be started silently in the background.
-- enable the commented out code under `ENABLE_FILE_TYPE_HANDLING` to handle specific file extensions e.g. use a different app than the one used for the category.
diff --git a/scripts/nlay/nlay b/scripts/nlay/nlay
deleted file mode 100755
index b3d587f..0000000
--- a/scripts/nlay/nlay
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/env bash
-
-# #############################################################################
-# nlay: a customizable script to play files in different apps by file type
-#
-# usage: nlay file/path type/action
-#
-# MUST READ:
-#
-# 1. Feel free to change the default apps to your favourite ones.
-# If you change the app for a group you may also need to modify the opts and
-# bg settings. If bg is set the app is detached and started in the background
-# in silent mode.
-#
-# The bg setting depends on personal preferences and type of utility, e.g., I
-# would start vi (CLI) in the foreground but Sublime Text (GUI) in background.
-#
-# Check (and TOGGLE as you wish) the default bg settings.
-#
-# 2. Detached apps are not killed when nnn exits. Use kill(1) or killall(1) to
-# stop console based background apps.
-#
-# 3. nlay is OVERWRITTEN during nnn upgrade. You can store your custom nlay in a
-# location other than the default and have an alias with nnn option '-p' to
-# invoke it. Remember it might break or lack new capabilities added to nlay
-# in future releases. Check the file diff once in a while.
-#
-# Author: Arun Prakash Jana
-# Email: engineerarun@gmail.com
-# Homepage: https://github.com/jarun/nnn
-# Copyright © 2016-2019 Arun Prakash Jana
-# #############################################################################
-
-
-# Enable the lines below to handle file by extension
-# This is provided for using a custom player for specific files
-# $ext holds the extension
-<<ENABLE_FILE_TYPE_HANDLING
-fname=$(basename "$1")
-if [[ $fname != *"."* ]]; then
- exit 1
-fi
-
-ext="${fname##*.}"
-if [ -z "$ext" ]; then
- exit 1
-fi
-
-# bash 4.0 way to switch to lowercase
-ext="${ext,,}"
-
-# handle this extension and exit
-ENABLE_FILE_TYPE_HANDLING
-
-
-#------------ PLAINTEXT (UNUSED) ------------
-if [ "$2" == "text" ]; then
- app=("vi")
-
- opts=("")
-
- bg=("")
-
-#----------------- SEARCH -------------------
-elif [ "$2" == "search" ]; then
- app=("gnome-search-tool"
- "catfish")
-
- opts=("--path"
- "--path")
-
- bg=(">/dev/null 2>&1 &"
- ">/dev/null 2>&1 &")
-
-#------------------ LOCKER ------------------
-elif [ "$2" == "locker" ]; then
- app=("vlock"
- "bashlock"
- "lock")
-
-for index in ${!app[@]}
-do
- type -P ${app[$index]} &>/dev/null &&
- eval ${app[$index]} &&
- exit 0
-done
-
-#------------------ SCRIPT ------------------
-elif [ "$2" == "script" ]; then
- # add commands or a custom script below
-
- # echo "my commands or custom script"
- # sh "path_to_script.sh"
- $SHELL "$1"
-
- exit 0
-fi
-
-#----------------- RUN APP ------------------
-for index in ${!app[@]}
-do
- type -P ${app[$index]} &>/dev/null &&
- eval ${app[$index]} ${opts[$index]} "\"$1\"" ${bg[$index]} &&
- break
-done
diff --git a/scripts/nlay/nlay.1 b/scripts/nlay/nlay.1
deleted file mode 100644
index 0a6a7b5..0000000
--- a/scripts/nlay/nlay.1
+++ /dev/null
@@ -1,37 +0,0 @@
-.Dd Mar 14, 2018
-.Dt NLAY 1
-.Os
-.Sh NAME
-.Nm nlay
-.Nd a bash script to play files in different apps by file type or run some actions.
-.Sh SYNOPSIS
-.Nm
-file/path type/action
-.Sh DESCRIPTION
-.Nm
-is shipped with \fInnn\fR to deliver a level of flexibility to users to choose their own apps when running some actions, run some commands or custom scripts. It has provisions to handle text files too. However, the capability is not used in the latest releases. Now
-.Nm
-is invoked to run a desktop search (\fIgnome-search-tool\fR or \fIcatfish\fR) or screen locker (\fIvlock\fR or \fIbashlock\fR or \fIlock\fR) utility. However,
-.Nm
-can run independently and can be highly customized for personal usage.
-.Pp
-.Nm
-supports the following options:
-.Pp
-"file/path"
- The first argument can be the file or path to pass as an argument to the app. It can also be an empty string e.g., while locking the terminal.
-.Pp
-"type/action"
- This can be any of the strings \fItext\fR, \fIsearch\fR, \fIscript\fR or \fIlocker\fR.
-.Sh USAGE
-.Pp
-.Bd -literal
-$ nlay info.txt text
-$ nlay . search
-$ nlay ~/script.sh script
-$ nlay "" locker
-.Ed
-.Sh AUTHOR
-.An Arun Prakash Jana Aq Mt engineerarun@gmail.com .
-.Sh HOME
-.Em https://github.com/jarun/nnn