dsurfraw 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. # runs browser with surfraw url through dmenu so one can choose
  3. # can have multiple prefixes for choice of browser or surfraw
  4. # function
  5. PATH=/usr/lib/surfraw:/usr/share/surfraw:${HOME}/.config/surfraw/elvi:${PATH}
  6. BROWSER=plumb
  7. # xdotool search --onlyvisible --class windowraise windowfocus
  8. MARKFILE="$HOME/lib/bookmarks"
  9. setbrowser() { BROWSER="$1"; url=$(echo "$url" | cut -c 4-); }
  10. sort "$MARKFILE" | dmenu.sh -i -l 10 -p 'link' | while read -r url; do
  11. [ ! "$url" ] && exit
  12. case "$(echo "$url"|cut -d " " -f1)" in
  13. ff) setbrowser firefox ;;
  14. st) setbrowser surf_tor ;;
  15. esac
  16. grep -q "$url" "$MARKFILE" && url=$(echo "$url" | sed 's/.* http/http/g')
  17. args=$(echo $url | sed -e 's/^\w* //')
  18. case $(echo "$url"| cut -d " " -f1) in
  19. *.*|*:*|*/*) "$BROWSER" "$url" ;;
  20. gberg|G) gutenberg -browser="$BROWSER" $args ;;
  21. uesp|tes) uesp -browser="$BROWSER" $args ;;
  22. ddg|D) duckduckgo -browser="$BROWSER" $args ;;
  23. q) qwant -browser="$BROWSER" $args ;;
  24. aw|awiki) archwiki -browser="$BROWSER" $args ;;
  25. wi|wiki) infogalactic -browser="$BROWSER" $args ;;
  26. wq|wikiq) wikiquote -browser="$BROWSER" $args ;;
  27. imdb) imdb -browser="$BROWSER" $args ;;
  28. map) google -m -browser="$BROWSER" $args ;;
  29. # yt|youtube) sputube -browser="$BROWSER" $args ;;
  30. yt|youtube) Yt $args ;;
  31. git|github) github -browser="$BROWSER" $args ;;
  32. ru) rutracker -browser="$BROWSER" $args ;;
  33. aarg) aaaaarg -browser="$BROWSER" $args ;;
  34. gen) libgen -browser="$BROWSER" $args ;;
  35. sp|S) startpage -browser="$BROWSER" $args ;;
  36. cr) crossref -browser="$BROWSER" $args ;;
  37. gr) perseus -browser="$BROWSER" $args ;;
  38. sw) swisscows -browser="$BROWSER" $args ;;
  39. *) duckduckgo -browser="$BROWSER" $url ;;
  40. esac &
  41. sleep 0.1
  42. done