mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-24 16:28:22 -05:00
nnn: update settings for v4.1
Also WMs: clean up application rules
This commit is contained in:
parent
3d0e045de2
commit
30ed001766
@ -54,14 +54,9 @@ bspc config presel_feedback_color "#d8dee9"
|
||||
# bspc config presel_feedback_color "#abb2bf"
|
||||
|
||||
# Program rules
|
||||
bspc rule -a "Gimp-2.10" state=floating follow=on
|
||||
bspc rule -a "Gimp" state=floating follow=on
|
||||
bspc rule -a "Thunderbird" desktop='^3' follow=on
|
||||
bspc rule -a "Inkscape" state=floating follow=on
|
||||
bspc rule -a "krita" state=floating follow=on
|
||||
bspc rule -a "mpv" desktop='^6' state=tiled follow=on
|
||||
bspc rule -a "Zathura" desktop='^4' follow=on
|
||||
bspc rule -a "Element" desktop='^7' follow=on
|
||||
bspc rule -a "TelegramDesktop" desktop='^7' follow=on
|
||||
bspc rule -a "Emacs" state=tiled
|
||||
bspc rule -a "Komikku" state=floating follow=on
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Description: Allows for creation of multiple files/directories at the same time.
|
||||
# Plugin opens a temp file where each entry is to be written on a separate line
|
||||
# Description: Allows for creation of multiple files/dirs simultaneously
|
||||
# Creates a tmp file to write each entry in a separate line
|
||||
#
|
||||
# Note: Only relative paths are supported. Absolute paths are ignored
|
||||
# Leading and trailing whitespace in path names is also ignored
|
||||
|
@ -1,22 +1,99 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Description: Run fzf and go to the directory of the file selected
|
||||
# Description: Fuzzy search multiple locations read-in from a path-list file
|
||||
# (or $PWD) and open the selected file's dir in a smart context.
|
||||
# Dependencies: fzf, fd (only for multi-location search)
|
||||
#
|
||||
# Details: Paths in list file should be newline-separated absolute paths.
|
||||
# Paths can be file paths; the script will scan the parent dirs.
|
||||
#
|
||||
# The path-list file precedence is:
|
||||
# - "$1" (the hovered file) if it exists, is plain-text and the
|
||||
# first line points to an existing file
|
||||
# - "$LIST" if set below
|
||||
# - "$2" (the current directory) [mimics plugin fzcd behaviour]
|
||||
#
|
||||
# The path-list file can be generated easily:
|
||||
# - pick the (file)paths in picker mode to path-list file
|
||||
# - OR, edit selection in nnn and save as path-list file
|
||||
#
|
||||
# The plugin clears nnn selection as the user can be tempted to delete
|
||||
# duplicate files after finding copies and remove selection by mistake.
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Anna Arad
|
||||
# Author: Anna Arad, Arun Prakash Jana
|
||||
|
||||
IFS="$(printf '\n\r')"
|
||||
|
||||
. "$(dirname "$0")"/.nnn-plugin-helper
|
||||
|
||||
if [ "$(cmd_exists fzf)" -eq "0" ]; then
|
||||
sel=$(fd --type d --follow --hidden --exclude .git | fzf --preview 'exa -1a --sort=type --color always --icons {} 2>/dev/null')
|
||||
else
|
||||
CTX=+
|
||||
LIST="$LIST"
|
||||
|
||||
if ! type fzf >/dev/null 2>&1; then
|
||||
printf "fzf missing"
|
||||
read -r _
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$sel" ]; then
|
||||
# Check if selected path returned by fzf command is absolute
|
||||
case $sel in
|
||||
/*) nnn_cd "$sel" ;;
|
||||
*) nnn_cd "$PWD/$sel" ;;
|
||||
esac
|
||||
if [ -n "$1" ] && [ "$(file -b --mime-type "$1")" = 'text/plain' ] && [ -e "$(head -1 "$1")" ]; then
|
||||
LIST="$1"
|
||||
elif ! [ -s "$LIST" ]; then
|
||||
# Clear selection
|
||||
if [ -p "$NNN_PIPE" ]; then
|
||||
printf "-" >"$NNN_PIPE"
|
||||
fi
|
||||
|
||||
sel=$(fzf)
|
||||
# Show only the file and parent dir
|
||||
# sel=$(fzf --delimiter / --with-nth=-2,-1 --tiebreak=begin --info=hidden)
|
||||
|
||||
LIST=''
|
||||
fi
|
||||
|
||||
if [ -n "$LIST" ]; then
|
||||
if type fd >/dev/null 2>&1; then
|
||||
tmpfile=$(mktemp /tmp/abc-script.XXXXXX)
|
||||
|
||||
while IFS= read -r path; do
|
||||
if [ -d "$path" ]; then
|
||||
printf "%s\n" "$path" >> "$tmpfile"
|
||||
elif [ -f "$path" ]; then
|
||||
printf "%s\n" "$(dirname "$path")" >> "$tmpfile"
|
||||
fi
|
||||
done < "$LIST"
|
||||
|
||||
# Clear selection
|
||||
if [ -p "$NNN_PIPE" ]; then
|
||||
printf "-" >"$NNN_PIPE"
|
||||
fi
|
||||
|
||||
sel=$(xargs -d '\n' -a "$tmpfile" fd -H . | fzf --delimiter / --tiebreak=begin --info=hidden)
|
||||
|
||||
rm "$tmpfile"
|
||||
else
|
||||
printf "fd missing"
|
||||
read -r _
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$sel" ]; then
|
||||
if [ "$sel" = "." ] || { ! [ -d "$sel" ] && ! [ -f "$sel" ]; }; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if the selected path returned by fzf command is absolute
|
||||
case $sel in
|
||||
/*) nnn_cd "$sel" "$CTX" ;;
|
||||
*)
|
||||
# Remove "./" prefix if it exists
|
||||
sel="${sel#./}"
|
||||
|
||||
if [ "$PWD" = "/" ]; then
|
||||
nnn_cd "/$sel" "$CTX"
|
||||
else
|
||||
nnn_cd "$PWD/$sel" "$CTX"
|
||||
fi;;
|
||||
esac
|
||||
fi
|
||||
|
@ -1,30 +1,57 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Description: Fuzzy find a file in directory subtree
|
||||
# Opens in $VISUAL or $EDITOR if text
|
||||
# Opens other type of files with xdg-open
|
||||
# Description: Regular mode:
|
||||
# Fuzzy find a file in directory subtree.
|
||||
# Opens in $VISUAL or $EDITOR if text.
|
||||
# Opens other type of files with xdg-open.
|
||||
# Work only with a single file selected.
|
||||
#
|
||||
# Picker mode:
|
||||
# If picker mode output file is passed, it
|
||||
# will be overwritten with any picked files.
|
||||
# Leaves untouched if no file is picked.
|
||||
# Works with single/multiple files selected.
|
||||
#
|
||||
# Dependencies: fd/find, fzf/skim, xdg-open
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Arun Prakash Jana
|
||||
|
||||
if which fzf >/dev/null 2>&1; then
|
||||
. "$(dirname "$0")"/.nnn-plugin-helper
|
||||
|
||||
if type fzf >/dev/null 2>&1; then
|
||||
cmd="$FZF_DEFAULT_COMMAND"
|
||||
if which fd >/dev/null 2>&1; then
|
||||
if type fd >/dev/null 2>&1; then
|
||||
[ -z "$cmd" ] && cmd="fd -t f 2>/dev/null"
|
||||
else
|
||||
[ -z "$cmd" ] && cmd="find . -type f 2>/dev/null"
|
||||
fi
|
||||
entry="$(eval "$cmd" | fzf --delimiter / --nth=-1 --tiebreak=begin --info=hidden)"
|
||||
entry="$(eval "$cmd" | fzf -m --delimiter / --nth=-1 --tiebreak=begin --info=hidden)"
|
||||
# To show only the file name
|
||||
# entry=$(find . -type f 2>/dev/null | fzf --delimiter / --with-nth=-1 --tiebreak=begin --info=hidden)
|
||||
elif which sk >/dev/null 2>&1; then
|
||||
elif type sk >/dev/null 2>&1; then
|
||||
entry=$(find . -type f 2>/dev/null | sk)
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for picker mode
|
||||
if [ "$3" ]; then
|
||||
if [ "$entry" ]; then
|
||||
if [ "-" = "$3" ]; then
|
||||
printf "%s\n" "$entry"
|
||||
else
|
||||
printf "%s\n" "$entry" > "$3"
|
||||
fi
|
||||
|
||||
# Tell `nnn` to clear its internal selection
|
||||
printf "%s" "0p" > "$NNN_PIPE"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Open the file (works for a single file only)
|
||||
case "$(file -biL "$entry")" in
|
||||
*text*)
|
||||
"${VISUAL:-$EDITOR}" "$entry" ;;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
. "$(dirname "$0")"/.nnn-plugin-helper
|
||||
|
||||
if which fzf >/dev/null 2>&1; then
|
||||
if type fzf >/dev/null 2>&1; then
|
||||
fuzzy="fzf --no-multi"
|
||||
else
|
||||
exit 1
|
||||
|
@ -1,8 +1,10 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Description: Decrypts selected files using gpg. The contents of the decrypted file are stored in a file with extension .dec
|
||||
# Description: Decrypts selected files using gpg. The contents of the
|
||||
# decrypted file are stored in a file with extension .dec
|
||||
#
|
||||
# Note: If an appropriate private key cannot be found gpg silently prints a message in the background and no files are written.
|
||||
# Note: If an appropriate private key cannot be found gpg silently
|
||||
# prints a message in the background and no files are written.
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: KlzXS
|
||||
|
@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Description: Encrypts selected files using gpg. Can encrypt either asymmetrically (key) or symmetrically (passphrase).
|
||||
# If asymmetric encryption is chosen a key can be chosen from the list of capable public keys using fzf.
|
||||
# Description: Encrypts selected files using gpg. Can encrypt
|
||||
# asymmetrically (key) or symmetrically (passphrase).
|
||||
# If asymmetric encryption is chosen a key can be
|
||||
# chosen from the list of capable public keys using fzf.
|
||||
#
|
||||
# Note: symmetric encryption only works for a single (current) file as per gpg limitations
|
||||
# Note: Symmetric encryption only works for a single (current) file as per gpg limitations
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: KlzXS
|
||||
|
@ -1,13 +1,14 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Description: View a file in hex
|
||||
#
|
||||
# Dependencies: hx (https://github.com/krpors/hx)/xxd and $PAGER
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Arun Prakash Jana
|
||||
|
||||
if ! [ -z "$1" ]; then
|
||||
if which hx >/dev/null 2>&1; then
|
||||
if [ -n "$1" ]; then
|
||||
if type hx >/dev/null 2>&1; then
|
||||
hx "$1"
|
||||
else
|
||||
xxd "$1" | $PAGER
|
||||
|
@ -4,19 +4,21 @@
|
||||
# If the device is not mounted, it will be mounted.
|
||||
# If the device is mounted, it will be unmounted and powered down.
|
||||
#
|
||||
# Runs `lsblk` if 'l' is entered, exits on 'Return`.
|
||||
# Dependencies: lsblk, pmount
|
||||
#
|
||||
# Note:
|
||||
# - The script uses Linux-specific lsblk to list block devices. Alternatives:
|
||||
# Usage: Runs `lsblk` on 'l', exits on 'Return`.
|
||||
#
|
||||
# Notes:
|
||||
# - The script uses Linux-specific lsblk to list block devices. Alternatives:
|
||||
# macOS: "diskutil list"
|
||||
# BSD: "geom disk list"
|
||||
# - The script uses udisksctl (from udisks2) to pwoer down devices. This is also Linux-specific.
|
||||
# Users on non-Linux platforms can comment it and use an alterntive to power-down disks.
|
||||
# - The script uses udisksctl (from udisks2) to power down devices. This is also Linux-specific.
|
||||
# Users on non-Linux platforms can comment it and use an alterntive to power-down disks.
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Arun Prakash Jana
|
||||
|
||||
prompt="device name ['l' lists]: "
|
||||
prompt="device name [e.g. sdXn] ('l'ist, 'q'uit): "
|
||||
|
||||
lsblk
|
||||
|
||||
@ -24,7 +26,7 @@ printf "\nEnsure you aren't still in the mounted device.\n"
|
||||
printf "%s" "$prompt"
|
||||
read -r dev
|
||||
|
||||
while ! [ -z "$dev" ]
|
||||
while [ -n "$dev" ]
|
||||
do
|
||||
if [ "$dev" = "l" ]; then
|
||||
lsblk
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# #############################################################################
|
||||
# Description: Sample script to play files in apps by file type or mime
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
@ -14,7 +13,7 @@
|
||||
# 2. Run nnn with the program option to indicate a CLI opener
|
||||
# nnn -c
|
||||
# # The -c program option overrides option -e
|
||||
# 3. nuke can use nnn plugins (e.g. mocplay is used for audio), $PATH is updated.
|
||||
# 3. nuke can use nnn plugins (e.g. mocq is used for audio), $PATH is updated.
|
||||
#
|
||||
# Details:
|
||||
# Inspired by ranger's scope.sh, modified for usage with nnn.
|
||||
@ -42,7 +41,7 @@
|
||||
# rar: list with unrar
|
||||
# 7-zip: list with 7z
|
||||
# pdf: zathura (GUI), pdftotext, mutool, exiftool
|
||||
# audio: mocplay (nnn plugin using MOC), mpv, media_client (Haiku), mediainfo, exiftool
|
||||
# audio: mocq (nnn plugin using MOC), mpv, media_client (Haiku), mediainfo, exiftool
|
||||
# avi|mkv|mp4: smplayer, mpv (GUI), ffmpegthumbnailer, mediainfo, exiftool
|
||||
# log: vi
|
||||
# torrent: rtorrent, transmission-show
|
||||
@ -53,17 +52,16 @@
|
||||
# Multimedia by mime:
|
||||
# image/*: imv/sxiv (GUI), viu (https://github.com/atanunq/viu), img2txt, exiftool
|
||||
# video/*: smplayer, mpv (GUI), ffmpegthumbnailer, mediainfo, exiftool
|
||||
# audio/*: mocplay (nnn plugin using MOC), mpv, media_client (Haiku), mediainfo, exiftool
|
||||
# audio/*: mocq (nnn plugin using MOC), mpv, media_client (Haiku), mediainfo, exiftool
|
||||
# application/pdf: zathura (GUI), pdftotext, mutool, exiftool
|
||||
# Other mimes:
|
||||
# text/troff: man -l
|
||||
# text/* | */xml: vi
|
||||
# image/vnd.djvu): djvutxt, exiftool
|
||||
#
|
||||
# ToDo:
|
||||
# TODO:
|
||||
# 1. Adapt, test and enable all mimes
|
||||
# 2. Clean-up the unnecessary exit codes
|
||||
# #############################################################################
|
||||
|
||||
# set to 1 to enable GUI apps
|
||||
GUI="${GUI:-0}"
|
||||
@ -88,67 +86,68 @@ is_mac() {
|
||||
}
|
||||
|
||||
handle_pdf() {
|
||||
if [ "$GUI" -ne 0 ] && is_mac; then
|
||||
nohup open "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif [ "$GUI" -ne 0 ] && which zathura >/dev/null 2>&1; then
|
||||
nohup zathura "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif which pdftotext >/dev/null 2>&1; then
|
||||
if [ "$GUI" -ne 0 ]; then
|
||||
if is_mac; then
|
||||
nohup open "${FPATH}" >/dev/null 2>&1 &
|
||||
elif type zathura >/dev/null 2>&1; then
|
||||
nohup zathura "${FPATH}" >/dev/null 2>&1 &
|
||||
else
|
||||
return
|
||||
fi
|
||||
elif type pdftotext >/dev/null 2>&1; then
|
||||
## Preview as text conversion
|
||||
pdftotext -l 10 -nopgbrk -q -- "${FPATH}" - | eval "$PAGER"
|
||||
exit 0
|
||||
elif which mutool >/dev/null 2>&1; then
|
||||
elif type mutool >/dev/null 2>&1; then
|
||||
mutool draw -F txt -i -- "${FPATH}" 1-10 | eval "$PAGER"
|
||||
exit 0
|
||||
elif which exiftool >/dev/null 2>&1; then
|
||||
elif type exiftool >/dev/null 2>&1; then
|
||||
exiftool "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
else
|
||||
return
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
handle_audio() {
|
||||
if which mocp >/dev/null 2>&1 && which mocplay >/dev/null 2>&1; then
|
||||
mocplay "${FPATH}" "opener" >/dev/null 2>&1
|
||||
exit 0
|
||||
elif which mpv >/dev/null 2>&1; then
|
||||
if type mocp >/dev/null 2>&1 && type mocq >/dev/null 2>&1; then
|
||||
mocq "${FPATH}" "opener" >/dev/null 2>&1
|
||||
elif type mpv >/dev/null 2>&1; then
|
||||
mpv "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif which media_client >/dev/null 2>&1; then
|
||||
elif type media_client >/dev/null 2>&1; then
|
||||
media_client play "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif which mediainfo >/dev/null 2>&1; then
|
||||
elif type mediainfo >/dev/null 2>&1; then
|
||||
mediainfo "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
elif which exiftool >/dev/null 2>&1; then
|
||||
elif type exiftool >/dev/null 2>&1; then
|
||||
exiftool "${FPATH}"| eval "$PAGER"
|
||||
exit 0
|
||||
else
|
||||
return
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
handle_video() {
|
||||
if [ "$GUI" -ne 0 ] && is_mac; then
|
||||
nohup open "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif [ "$GUI" -ne 0 ] && which smplayer >/dev/null 2>&1; then
|
||||
nohup smplayer "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif [ "$GUI" -ne 0 ] && which mpv >/dev/null 2>&1; then
|
||||
nohup mpv "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif which ffmpegthumbnailer >/dev/null 2>&1; then
|
||||
if [ "$GUI" -ne 0 ]; then
|
||||
if is_mac; then
|
||||
nohup open "${FPATH}" >/dev/null 2>&1 &
|
||||
elif type smplayer >/dev/null 2>&1; then
|
||||
nohup smplayer "${FPATH}" >/dev/null 2>&1 &
|
||||
elif type mpv >/dev/null 2>&1; then
|
||||
nohup mpv "${FPATH}" >/dev/null 2>&1 &
|
||||
else
|
||||
return
|
||||
fi
|
||||
elif type ffmpegthumbnailer >/dev/null 2>&1; then
|
||||
# Thumbnail
|
||||
[ -d "${IMAGE_CACHE_PATH}" ] || mkdir "${IMAGE_CACHE_PATH}"
|
||||
ffmpegthumbnailer -i "${FPATH}" -o "${IMAGE_CACHE_PATH}/${FNAME}.jpg" -s 0
|
||||
viu -n "${IMAGE_CACHE_PATH}/${FNAME}.jpg" | eval "$PAGER"
|
||||
exit 0
|
||||
elif which mediainfo >/dev/null 2>&1; then
|
||||
elif type mediainfo >/dev/null 2>&1; then
|
||||
mediainfo "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
elif which exiftool >/dev/null 2>&1; then
|
||||
elif type exiftool >/dev/null 2>&1; then
|
||||
exiftool "${FPATH}"| eval "$PAGER"
|
||||
exit 0
|
||||
else
|
||||
return
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
# handle this extension and exit
|
||||
@ -157,22 +156,22 @@ handle_extension() {
|
||||
## Archive
|
||||
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
|
||||
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
|
||||
if which atool >/dev/null 2>&1; then
|
||||
if type atool >/dev/null 2>&1; then
|
||||
atool --list -- "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
elif which bsdtar >/dev/null 2>&1; then
|
||||
elif type bsdtar >/dev/null 2>&1; then
|
||||
bsdtar --list --file "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
fi
|
||||
exit 1;;
|
||||
rar)
|
||||
if which unrar >/dev/null 2>&1; then
|
||||
if type unrar >/dev/null 2>&1; then
|
||||
## Avoid password prompt by providing empty password
|
||||
unrar lt -p- -- "${FPATH}" | eval "$PAGER"
|
||||
fi
|
||||
exit 1;;
|
||||
7z)
|
||||
if which 7z >/dev/null 2>&1; then
|
||||
if type 7z >/dev/null 2>&1; then
|
||||
## Avoid password prompt by providing empty password
|
||||
7z l -p -- "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
@ -201,10 +200,10 @@ handle_extension() {
|
||||
|
||||
## BitTorrent
|
||||
torrent)
|
||||
if which rtorrent >/dev/null 2>&1; then
|
||||
if type rtorrent >/dev/null 2>&1; then
|
||||
rtorrent "${FPATH}"
|
||||
exit 0
|
||||
elif which transmission-show >/dev/null 2>&1; then
|
||||
elif type transmission-show >/dev/null 2>&1; then
|
||||
transmission-show -- "${FPATH}"
|
||||
exit 0
|
||||
fi
|
||||
@ -212,7 +211,7 @@ handle_extension() {
|
||||
|
||||
## OpenDocument
|
||||
odt|ods|odp|sxw)
|
||||
if which odt2txt >/dev/null 2>&1; then
|
||||
if type odt2txt >/dev/null 2>&1; then
|
||||
## Preview as text conversion
|
||||
odt2txt "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
@ -221,10 +220,10 @@ handle_extension() {
|
||||
|
||||
## Markdown
|
||||
md)
|
||||
if which glow >/dev/null 2>&1; then
|
||||
if type glow >/dev/null 2>&1; then
|
||||
glow -sdark "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
elif which lowdown >/dev/null 2>&1; then
|
||||
elif type lowdown >/dev/null 2>&1; then
|
||||
lowdown -Tterm "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
fi
|
||||
@ -233,13 +232,13 @@ handle_extension() {
|
||||
## HTML
|
||||
htm|html|xhtml)
|
||||
## Preview as text conversion
|
||||
if which w3m >/dev/null 2>&1; then
|
||||
if type w3m >/dev/null 2>&1; then
|
||||
w3m -dump "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
elif which lynx >/dev/null 2>&1; then
|
||||
elif type lynx >/dev/null 2>&1; then
|
||||
lynx -dump -- "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
elif which elinks >/dev/null 2>&1; then
|
||||
elif type elinks >/dev/null 2>&1; then
|
||||
elinks -dump "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
fi
|
||||
@ -247,10 +246,10 @@ handle_extension() {
|
||||
|
||||
## JSON
|
||||
json)
|
||||
if which jq >/dev/null 2>&1; then
|
||||
if type jq >/dev/null 2>&1; then
|
||||
jq --color-output . "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
elif which python >/dev/null 2>&1; then
|
||||
elif type python >/dev/null 2>&1; then
|
||||
python -m json.tool -- "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
fi
|
||||
@ -308,22 +307,24 @@ handle_multimedia() {
|
||||
|
||||
## Image
|
||||
image/*)
|
||||
if [ "$GUI" -ne 0 ] && is_mac; then
|
||||
nohup 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
|
||||
load_dir sxiv "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif which viu >/dev/null 2>&1; then
|
||||
if [ "$GUI" -ne 0 ]; then
|
||||
if is_mac; then
|
||||
nohup open "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif type imvr >/dev/null 2>&1; then
|
||||
load_dir imvr "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif type sxiv >/dev/null 2>&1; then
|
||||
load_dir sxiv "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
fi
|
||||
elif type viu >/dev/null 2>&1; then
|
||||
viu -n "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
elif which img2txt >/dev/null 2>&1; then
|
||||
elif type img2txt >/dev/null 2>&1; then
|
||||
img2txt --gamma=0.6 -- "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
elif which exiftool >/dev/null 2>&1; then
|
||||
elif type exiftool >/dev/null 2>&1; then
|
||||
exiftool "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
fi
|
||||
@ -466,11 +467,11 @@ handle_mime() {
|
||||
|
||||
## DjVu
|
||||
image/vnd.djvu)
|
||||
if which djvutxt >/dev/null 2>&1; then
|
||||
if type djvutxt >/dev/null 2>&1; then
|
||||
## Preview as text conversion (requires djvulibre)
|
||||
djvutxt "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
elif which exiftool >/dev/null 2>&1; then
|
||||
elif type exiftool >/dev/null 2>&1; then
|
||||
exiftool "${FPATH}" | eval "$PAGER"
|
||||
exit 0
|
||||
fi
|
||||
@ -479,12 +480,14 @@ handle_mime() {
|
||||
}
|
||||
|
||||
handle_fallback() {
|
||||
if [ "$GUI" -ne 0 ] && which xdg-open >/dev/null 2>&1; then
|
||||
nohup xdg-open "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif [ "$GUI" -ne 0 ] && which open >/dev/null 2>&1; then
|
||||
nohup open "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
if [ "$GUI" -ne 0 ]; then
|
||||
if type xdg-open >/dev/null 2>&1; then
|
||||
nohup xdg-open "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif type open >/dev/null 2>&1; then
|
||||
nohup open "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo '----- File details -----' && file --dereference --brief -- "${FPATH}"
|
||||
|
@ -3,21 +3,21 @@
|
||||
# Description: Batch rename selection or current directory with qmv
|
||||
#
|
||||
# Notes:
|
||||
# - Try to mimic current batch rename functionality but with correct
|
||||
# handling of edge cases by qmv or vidir.
|
||||
# Qmv opens with hidden files if no selection is used. Selected
|
||||
# directories are shown.
|
||||
# Vidir don't show directories nor hidden files.
|
||||
# - Try to mimic current batch rename functionality but with correct
|
||||
# handling of edge cases by qmv or vidir.
|
||||
# - Qmv opens with hidden files if no selection is used. Selected
|
||||
# directories are shown.
|
||||
# - Vidir don't show directories nor hidden files.
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: José Neder
|
||||
|
||||
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||
|
||||
if which qmv >/dev/null 2>&1; then
|
||||
if type qmv >/dev/null 2>&1; then
|
||||
batchrenamesel="qmv -fdo -da"
|
||||
batchrename="qmv -fdo -a"
|
||||
elif which vidir >/dev/null 2>&1; then
|
||||
elif type vidir >/dev/null 2>&1; then
|
||||
batchrenamesel="vidir"
|
||||
batchrename="vidir"
|
||||
else
|
||||
@ -33,6 +33,11 @@ fi
|
||||
if [ "$resp" = "y" ]; then
|
||||
# -o flag is necessary for interactive editors
|
||||
xargs -o -0 $batchrenamesel < "$selection"
|
||||
|
||||
# Clear selection
|
||||
if [ -p "$NNN_PIPE" ]; then
|
||||
printf "-" > "$NNN_PIPE"
|
||||
fi
|
||||
elif [ ! "$(LC_ALL=C ls -a)" = ".
|
||||
.." ]; then
|
||||
# On older systems that don't have ls -A
|
||||
|
@ -7,15 +7,10 @@
|
||||
|
||||
EDITOR="${EDITOR:-vim}"
|
||||
|
||||
is_cmd_exists () {
|
||||
which "$1" > /dev/null 2>&1
|
||||
echo $?
|
||||
}
|
||||
|
||||
if [ "$(is_cmd_exists sudo)" -eq "0" ]; then
|
||||
if type sudo >/dev/null 2>&1; then
|
||||
sudo "$EDITOR" "$1"
|
||||
elif [ "$(is_cmd_exists sudoedit)" -eq "0" ]; then
|
||||
elif type sudoedit >/dev/null 2>&1; then
|
||||
sudoedit "$1"
|
||||
elif [ "$(is_cmd_exists doas)" -eq "0" ]; then
|
||||
elif type doas >/dev/null 2>&1; then
|
||||
doas "$EDITOR" "$1"
|
||||
fi
|
||||
|
@ -78,13 +78,8 @@ modkey = Mod4
|
||||
# QUIRKS
|
||||
quirk[Firefox:Dialog] = FLOAT
|
||||
quirk[Element] = WS[7]
|
||||
quirk[TelegramDesktop] = WS[7]
|
||||
quirk[Zathura] = WS[4]
|
||||
quirk[mpv] = WS[6]
|
||||
quirk[krita] = FLOAT
|
||||
quirk[Inkscape] = FLOAT
|
||||
quirk[Gimp-2.10] = FLOAT
|
||||
quirk[Gimp] = FLOAT
|
||||
quirk[Thunderbird] = WS[3]
|
||||
quirk[Emacs:emacs] = IGNORESPAWNWS
|
||||
quirk[Komikku] = FLOAT
|
||||
|
@ -78,13 +78,8 @@ modkey = Mod4
|
||||
# QUIRKS
|
||||
quirk[Firefox:Dialog] = FLOAT
|
||||
quirk[Element] = WS[7]
|
||||
quirk[TelegramDesktop] = WS[7]
|
||||
quirk[Zathura] = WS[4]
|
||||
quirk[mpv] = WS[6]
|
||||
quirk[krita] = FLOAT
|
||||
quirk[Inkscape] = FLOAT
|
||||
quirk[Gimp-2.10] = FLOAT
|
||||
quirk[Gimp] = FLOAT
|
||||
quirk[Thunderbird] = WS[3]
|
||||
quirk[Emacs:emacs] = IGNORESPAWNWS
|
||||
quirk[Komikku] = FLOAT
|
||||
|
@ -342,9 +342,6 @@ bindsym $mod+Shift+0 move container to workspace $ws10
|
||||
#
|
||||
# Floating
|
||||
for_window [app_id="info.febvre.Komikku"] floating enable
|
||||
for_window [class="Gimp-2.10"] floating enable
|
||||
for_window [app_id="org.inkscape.Inkscape"] floating enable
|
||||
for_window [class="krita"] floating enable
|
||||
for_window [title="About Mozilla Firefox"] floating enable
|
||||
for_window [title="Picture-in-Picture"] floating enable
|
||||
|
||||
@ -353,4 +350,3 @@ assign [app_id="thunderbird"] $ws3
|
||||
assign [app_id="org.pwmt.zathura"] $ws4
|
||||
assign [app_id="mpv"] $ws6
|
||||
assign [class="Element"] $ws7
|
||||
assign [app_id="org.telegram.desktop.desktop"] $ws7
|
||||
|
13
setup/nnn.sh
13
setup/nnn.sh
@ -1,13 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
git clone https://github.com/FollieHiyuki/nnn.git
|
||||
cd nnn
|
||||
|
||||
if command -v doas >/dev/null
|
||||
then
|
||||
doas -- make O_NERD=1 PREFIX=/usr install
|
||||
else
|
||||
sudo make O_NERD=1 PREFIX=/usr install
|
||||
fi
|
||||
|
||||
cd ..
|
Loading…
Reference in New Issue
Block a user