Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #!/bin/zsh
  2.  
  3. cd /home/lulu/
  4. directory=$(pwd)
  5. files=$(fzf -m)
  6. cd -
  7.  
  8. pdfs=""
  9. multiple_pdfs=""
  10.  
  11. while read -r file; do
  12. file="$directory/$file"
  13.  
  14. if [ "$(head -c 4 "$file")" = "%PDF" ]; then
  15. if [ -z "$pdfs" ]; then
  16. pdfs="$file"
  17. else
  18. pdfs="$pdfs $file"
  19. multiple_pdfs="true"
  20. fi
  21. else
  22. i3-msg exec xdg-open "$file"
  23. fi
  24. done <<< "$files"
  25.  
  26. if ! [ -z "$pdfs" ]; then
  27. if [ -z "$multiple_pdfs" ]; then
  28. i3-msg exec zathura $pdfs
  29. else
  30. i3-msg exec "tabbed -c zathura "$pdfs" -e"
  31. fi
  32. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement