]> Sergey Matveev's repositories - nnn.git/commitdiff
Update plugins, add mutool to view PDF
authorArun Prakash Jana <engineerarun@gmail.com>
Fri, 31 May 2019 18:47:19 +0000 (00:17 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Fri, 31 May 2019 19:04:07 +0000 (00:34 +0530)
plugins/README.md
plugins/nmount
plugins/pdfview

index 107bf992373bb917cac437c894805ff94e554766..1e739d397283173af9c0bfab438faf2b66e0a3d9 100644 (file)
@@ -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))|
index aa72791884ceef08a2344b1f8d59bf6530592c84..53eaf232fd4b425a42ba1167d1b775a20586b7e2 100755 (executable)
@@ -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
index 20884d452ab5ed11c99684f4bc6e1bf279652682..17f45e0e1b6076eb9aae148f369c90dc4fdb1d68 100755 (executable)
@@ -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