diff options
| author | 2020-08-20 03:21:26 -0600 | |
|---|---|---|
| committer | 2020-08-20 14:51:26 +0530 | |
| commit | 1afdd48f5d2eddbe0e19ad2ed59d4b161fe743ca (patch) | |
| tree | 4be450c2344224527c31eff9a8fc3ad2b456059b /plugins/nuke | |
| parent | d78856626844bc14a09c271703f3a825ec1e8671 (diff) | |
| download | nnn-1afdd48f5d2eddbe0e19ad2ed59d4b161fe743ca.tar.gz | |
nuke: use macOS open when GUI enabled (#705)
* nuke: use macOS open when GUI enabled
* nuke: use is_mac function to test for macOS
This is consistent with how the imgur plugin does detection.
* Add macOS open command to plugins
* pskill: only execute if input is non-empty
Diffstat (limited to 'plugins/nuke')
| -rwxr-xr-x | plugins/nuke | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/plugins/nuke b/plugins/nuke index f2abe65..b783633 100755 --- a/plugins/nuke +++ b/plugins/nuke @@ -79,12 +79,19 @@ FNAME=$(basename "$1") EDITOR="${EDITOR:-vi}" PAGER="${PAGER:-less -R}" ext="${FNAME##*.}" -if ! [ -z "$ext" ]; then +if [ -n "$ext" ]; then ext="$(printf "%s" "${ext}" | tr '[:upper:]' '[:lower:]')" fi +is_mac() { + uname | grep -q "Darwin" +} + handle_pdf() { - if [ "$GUI" -ne 0 ] && which zathura >/dev/null 2>&1; then + if [ "$GUI" -ne 0 ] && is_mac; then + open "${FPATH}" >/dev/null 2>&1 & + exit 0 + elif [ "$GUI" -ne 0 ] && which zathura >/dev/null 2>&1; then zathura "${FPATH}" >/dev/null 2>&1 & exit 0 elif which pdftotext >/dev/null 2>&1; then @@ -120,7 +127,10 @@ handle_audio() { } handle_video() { - if [ "$GUI" -ne 0 ] && which smplayer >/dev/null 2>&1; then + if [ "$GUI" -ne 0 ] && is_mac; then + open "${FPATH}" >/dev/null 2>&1 & + exit 0 + elif [ "$GUI" -ne 0 ] && which smplayer >/dev/null 2>&1; then smplayer "${FPATH}" >/dev/null 2>&1 & exit 0 elif [ "$GUI" -ne 0 ] && which mpv >/dev/null 2>&1; then @@ -294,7 +304,10 @@ handle_multimedia() { ## Image image/*) - if [ "$GUI" -ne 0 ] && which imvr >/dev/null 2>&1; then + if [ "$GUI" -ne 0 ] && is_mac; then + open "${FPATH}" >/dev/null 2>&1 & + exit 0 + elif [ "$GUI" -ne 0 ] && which imvr >/dev/null 2>&1; then load_dir imvr "${FPATH}" >/dev/null 2>&1 & exit 0 elif [ "$GUI" -ne 0 ] && which sxiv >/dev/null 2>&1; then |