dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit ca1930cad4fcec4a9391c36d66cceea82adf53d4
parent 7e30854cf91b56b758aea2f9ef01573be8d2dd8d
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Tue, 23 Apr 2019 15:57:36 +0200

Add Zathura binding to extract and copy DOI to clipboard

Diffstat:
M.config/zathura/zathurarc | 2++
Mbin/getdoi | 7+++++++
2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc @@ -7,3 +7,5 @@ set adjust-open width set inputbar-fg "#aaaaaa" set completion-highlight-bg "#30303a" set completion-highlight-fg "#aaaaaa" + +map <C-o> feedkeys ":exec getdoi --clip '$FILE'<Return>" diff --git a/bin/getdoi b/bin/getdoi @@ -17,6 +17,7 @@ function show_help { echo " -V, --verbose show verbose information" echo " -t, --tor-socks use torsocks for HTTP requests" echo " -n, --number NUM return NUM results (default 1)" + echo " -c, --clip paste DOI to clipboard (requires xclip)" echo " -o, --open open DOI as url in browser" echo " -- do not consider any following args as options" } @@ -76,11 +77,14 @@ function get_doi { doi=$(get_doi_from_crossref "$@") fi echo "$doi" + [ "$clip" = 1 ] && echo "https://doi.org/${doi}" | \ + xclip -selection clipboard [ "$open" = 1 ] && browser_open "https://doi.org/${doi}" } verbose=0 number=1 +clip=0 open=0 prefix="" while :; do @@ -103,6 +107,9 @@ while :; do number="$2" shift ;; + -c|--clip) + clip=1 + ;; -o|--open) open=1 ;;