aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-11-22 23:53:57 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2019-11-22 23:53:57 +0100
commitbe80d285790fdf3380d735d2c0f64b08d9ee25e6 (patch)
tree63b732b8a2f60b9e41b24ddc20c0ff946b6e3a01
parent250604502694ca2093eb1b9af9a93e2f97522f56 (diff)
downloadscripts-be80d285790fdf3380d735d2c0f64b08d9ee25e6.tar.gz
scripts-be80d285790fdf3380d735d2c0f64b08d9ee25e6.zip
Created docs.sh to select a reference to open with zathura.
-rwxr-xr-xdocs.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/docs.sh b/docs.sh
new file mode 100755
index 0000000..0d02be2
--- /dev/null
+++ b/docs.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# docs.sh
+#
+# Usage: docs.sh
+#
+# Opens a pdf's specific page with zathura using a references file
+# The syntax of the references file must be:
+# Name#Absolute path to pdf#Page number
+# The only character with any logic is #, used to separate fields
+# Name can be anything and is just used for selection with dmenu
+
+referencesFile="$HOME/.config/zathura/refs"
+lines="$(wc -l "$referencesFile")"
+if reference="$(cut -d# -f1 <"$referencesFile" |
+ dmenu -i -l "$lines" -p "Reference: ")"; then
+ line="$(grep "$reference" "$referencesFile" | sed q)"
+ file="$(echo "$line" | cut -d# -f2)"
+ page="$(echo "$line" | cut -d# -f3)"
+ zathura -P "$page" "$file" &
+fi