From 987604a3a04d3c2348193aeb9fee9ecb75b7358e Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Tue, 3 Nov 2020 11:30:40 +0100 Subject: [PATCH] Add script to extract figure from page --- dotfiles/zathura.org | 110 +++++++++++++++++++++++++------------------ 1 file changed, 65 insertions(+), 45 deletions(-) diff --git a/dotfiles/zathura.org b/dotfiles/zathura.org index bd7c033..bb9155a 100644 --- a/dotfiles/zathura.org +++ b/dotfiles/zathura.org @@ -23,76 +23,96 @@ * Configuration #+BEGIN_SRC conf - # Use clipboard - set selection-clipboard clipboard +# Use clipboard +set selection-clipboard clipboard - # Remove padding - set statusbar-h-padding 0 - set statusbar-v-padding 0 +# Remove padding +set statusbar-h-padding 0 +set statusbar-v-padding 0 - # Padding between pages - set page-padding 1 +# Padding between pages +set page-padding 1 #+END_SRC * Bindings #+BEGIN_SRC conf - map u scroll half-up - map d scroll half-down +map u scroll half-up +map d scroll half-down - map D toggle_page_mode +map D toggle_page_mode - map r reload - map R rotate - map > rotate - map < rotate +map r reload +map R rotate +map > rotate +map < rotate - map L zoom in - map H zoom out +map L zoom in +map H zoom out - map i recolor - map p print +map i recolor +map p print - map t toggle_statusbar +map t toggle_statusbar - map scroll full-down - map scroll full-up +map scroll full-down +map scroll full-up +map feedkeys ":exec /home/thomas/.config/zathura/scripts/extract-pdf-page.sh $FILE" #+END_SRC * Colors #+begin_src conf - # Base16 Gruvbox dark, soft - # Author: Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox) +# Base16 Gruvbox dark, soft +# Author: Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox) - set default-bg "#32302f" - set default-fg "#3c3836" +set default-bg "#32302f" +set default-fg "#3c3836" - set statusbar-fg "#bdae93" - set statusbar-bg "#504945" +set statusbar-fg "#bdae93" +set statusbar-bg "#504945" - set inputbar-bg "#32302f" - set inputbar-fg "#fbf1c7" +set inputbar-bg "#32302f" +set inputbar-fg "#fbf1c7" - set notification-bg "#32302f" - set notification-fg "#fbf1c7" +set notification-bg "#32302f" +set notification-fg "#fbf1c7" - set notification-error-bg "#32302f" - set notification-error-fg "#fb4934" +set notification-error-bg "#32302f" +set notification-error-fg "#fb4934" - set notification-warning-bg "#32302f" - set notification-warning-fg "#fb4934" +set notification-warning-bg "#32302f" +set notification-warning-fg "#fb4934" - set highlight-color "#fabd2f" - set highlight-active-color "#83a598" +set highlight-color "#fabd2f" +set highlight-active-color "#83a598" - set completion-bg "#3c3836" - set completion-fg "#83a598" +set completion-bg "#3c3836" +set completion-fg "#83a598" - set completion-highlight-fg "#fbf1c7" - set completion-highlight-bg "#83a598" +set completion-highlight-fg "#fbf1c7" +set completion-highlight-bg "#83a598" - set recolor-lightcolor "#32302f" - set recolor-darkcolor "#ebdbb2" +set recolor-lightcolor "#32302f" +set recolor-darkcolor "#ebdbb2" - set recolor "false" - set recolor-keephue "false" +set recolor "false" +set recolor-keephue "false" +#+end_src + +* Scripts +:PROPERTIES: +:header-args: :shebang "#!/usr/bin/env bash" +:header-args+: :comments both :mkdirp yes +:END: + +** Extract one page as a PDF +#+begin_src bash :tangle ~/.config/zathura/scripts/extract-pdf-page.sh + tmpfile=/tmp/pdf_page.pdf + + # Ask for page number + # Ideally would get the page from Zathura... + pagenum=$(rofi -dmenu -p "Page Number") + + pdftk $1 cat $pagenum output $tmpfile.pdf && \ + pdf2svg $tmpfile.pdf $tmpfile.svg && \ + inkscape $tmpfile.svg #+end_src