diff options
| author | 2018-11-10 12:06:21 +0530 | |
|---|---|---|
| committer | 2018-11-10 12:06:21 +0530 | |
| commit | 497911e999d34fbb34a6abdb045afd3e6a6c2d1f (patch) | |
| tree | f5d292471d2b29a3e32a4fb562ea72827ab2b1e2 /nlay | |
| parent | a095ff485db66f8a98d27a0bee49d6b5118adbb8 (diff) | |
| download | nnn-497911e999d34fbb34a6abdb045afd3e6a6c2d1f.tar.gz | |
Retire nlay
Diffstat (limited to 'nlay')
| -rwxr-xr-x | nlay | 105 |
1 files changed, 0 insertions, 105 deletions
@@ -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-2018 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 &") - -#--------------- SCREENSAVER ---------------- -elif [ "$2" == "screensaver" ]; 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 |