scripts

scripts to make my pc work
Index Commits Files Refs
openbook (928B)
   1 #!/bin/sh
   2 
   3 # Prints a list of books in dmenu and opens the chosen one with the default pdfviewer
   4 # The arguments received are passthrough to dmenu
   5 # by github.com/mjkloeckner
   6 
   7 col_gray1="#000000"
   8 col_gray3="#cccccc"
   9 col_darkmagenta="#8B008B"
  10 col_gray4="#eeeeee"
  11 
  12 dir=$HOME/dox/books
  13 pdfviewer=zathura
  14 
  15 dmenufont='DejaVuSansMono Nerd Font:style=Regular:size=8'
  16 # dmenufont='Victor Mono:style=SemiBold:size=8';
  17 # dmenucmds="-i -l 30 -h 14 -z 750 -bw 2 -c $@"
  18 
  19 dmenucmds="-i -l 35 -h 10 -z 850 -bw 2 -c $@"
  20 
  21 bookname=$(ls $dir | dmenu $dmenucmds -nb $col_gray1 -nf $col_gray3 \
  22     -sb $col_darkmagenta -sf $col_gray4 -fn "$dmenufont")
  23 
  24 [ -z "$bookname" ] && exit
  25 
  26 [ $(file "$dir/$bookname" | cut -d ":" -f 2) = "directory" ] &&
  27     dir=$dir/$bookname && bookname=$(ls "$dir" | dmenu $dmenucmds \
  28     -nb $col_gray1 -nf $col_gray3 -sb $col_darkmagenta -sf $col_gray4 \
  29     -fn "$dmenufont" )
  30 
  31 [ -n "$bookname" ] && $pdfviewer "$dir/$bookname"