repos/scripts

Simple scripts that I made for my personal computer to map keys, make bluetooth work, brightness keys, etc.
Commits Files Refs README LICENSE
openbook (28 lines)
   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=9'
  17 # dmenucmds="-i -l 30 -h 14 -z 750 -bw 2 -c $@"
  18 
  19 dmenucmds="-i -l 30 -h 8 -z 850 -bw 2 -c $@"
  20 
  21 bookname=$(ls $dir | dmenu $dmenucmds -nb $col_gray1 -nf $col_gray3 -sb $col_darkmagenta -sf $col_gray4 -fn "$dmenufont")
  22 
  23 [ -z "$bookname" ] && exit
  24 
  25 [ "$(file "$dir/$bookname" | cut -d ":" -f 2)" = "directory" ] &&
  26     dir=$dir/$bookname && bookname=$(ls "$dir" | dmenu $dmenucmds -nb $col_gray1 -nf $col_gray3 -sb $col_darkmagenta -sf $col_gray4 -fn "$dmenufont" )
  27 
  28 [ -n "$bookname" ] && $pdfviewer "$dir/$bookname"