aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-06-01 00:17:19 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-06-01 00:34:07 +0530
commit9ba3cb3e9b426b72b14e6c616fdb35828e4b9f7c (patch)
treeb1382fc1bdb833299f0a2a5a606b6a212d00df3a /plugins
parent82e7a9870504cc87efbd259b2b47733be197e266 (diff)
downloadnnn-9ba3cb3e9b426b72b14e6c616fdb35828e4b9f7c.tar.gz
Update plugins, add mutool to view PDF
Diffstat (limited to 'plugins')
-rw-r--r--plugins/README.md6
-rwxr-xr-xplugins/nmount5
-rwxr-xr-xplugins/pdfview12
3 files changed, 19 insertions, 4 deletions
diff --git a/plugins/README.md b/plugins/README.md
index 107bf99..1e739d3 100644
--- a/plugins/README.md
+++ b/plugins/README.md
@@ -4,16 +4,16 @@
| fzy-edit | sh | fzy | Fuzzy find a file in directory subtree and edit in vim |
| fzy-open | sh | fzy | Fuzzy find a file in directory subtree and open using xdg-open |
| getplugs | sh | wget | Update plugins |
-| hexview | sh | xxd, `$PAGER` | View a file in hex |
+| hexview | sh | xxd | View a file in hex in `$PAGER` |
| imgresize | sh | [imgp](https://github.com/jarun/imgp) | Resize images in directory to screen resolution |
| imgur | bash | - | Upload an image to imgur (from [imgur-screenshot](https://github.com/jomo/imgur-screenshot)) |
| ipinfo | sh | curl, whois | Fetch external IP address and whois information |
| kdeconnect | sh | kdeconnect-cli | Send selected files to an Android device |
| ndiff | bash | vimdiff | Diff for selection (limited to 2 for directories) |
-| nmount | sh | pmount | Toggle mount status of a device as normal user |
+| nmount | sh | pmount, udisks2 | Toggle mount status of a device as normal user |
| nwal | sh | nitrogen | Set the selected image as wallpaper using nitrogen |
| pastebin | sh | [pastebinit](https://launchpad.net/pastebinit) | Paste contents of current (text) file to paste.ubuntu.com |
-| pdfview | sh | pdftotext, `$PAGER` | View current PDF file |
+| pdfview | sh | pdftotext/mupdf-tools | View current PDF file in `$PAGER` |
| picker | sh | nnn | Pick files and pipe the newline-separated list to another utility |
| pywal | sh | pywal | Set selected image as wallpaper, change terminal color scheme |
| sxiv | sh | sxiv | Browse images in a dir in sxiv, set wallpaper, copy path ([config](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts))|
diff --git a/plugins/nmount b/plugins/nmount
index aa72791..53eaf23 100755
--- a/plugins/nmount
+++ b/plugins/nmount
@@ -4,9 +4,12 @@
# If the device is not mounted, it will be mounted.
# If the device is mounted, it will be unmounted and powered down.
#
-# Note: The script uses Linux-specific lsblk to list block devices. Alternatives:
+# Note:
+# - 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.
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
diff --git a/plugins/pdfview b/plugins/pdfview
index 20884d4..17f45e0 100755
--- a/plugins/pdfview
+++ b/plugins/pdfview
@@ -2,11 +2,23 @@
# Description: View a PDF file in pager
#
+# Notes:
+# - $PAGER must be 'less -R' or 'most'
+# - To use mutool, uncomment the relevant lines and comment the pdftotext line
+#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
if ! [ -z "$1" ]; then
if [ $(head -c 4 "$1") = "%PDF" ]; then
+ # Convert using pdftotext
pdftotext -nopgbrk -layout "$1" - | sed 's/\xe2\x80\x8b//g' | $PAGER
+
+ # Convert using mutool
+ # file=`basename "$1"`
+ # txt=/tmp/"$file".txt
+ # mutool convert -o "$txt" "$1"
+ # eval $PAGER $txt
+ # rm "$txt"
fi
fi