Dotfiles for different machines on different branches.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
862 B

  1. #!/bin/sh
  2. # Feed script a url or file location.
  3. # If an image, it will view in sxiv,
  4. # if a video or gif, it will view in mpv
  5. # if a music file or pdf, it will download,
  6. # otherwise it opens link in browser.
  7. # If no url given. Opens browser. For using script as $BROWSER.
  8. [ -z "$1" ] && { "$BROWSER"; exit; }
  9. case "$1" in
  10. *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*)
  11. setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;;
  12. *png|*jpg|*jpe|*jpeg|*gif)
  13. curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
  14. *mp3|*flac|*opus|*mp3?source*)
  15. setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;;
  16. *)
  17. if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1"
  18. else setsid "$BROWSER" "$1" >/dev/null 2>&1 & fi ;;
  19. esac