Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.88 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. URI="$*"
  4.  
  5. test -n "$URI" && printf '%s' "$URI" | xsel -i || URI="$(xsel -b)"
  6.  
  7. color0="$(xrdb -query | grep color0: | awk '{print $2}')"
  8. colorbg="$(xrdb -query | grep background: | awk '{print $2}')"
  9. colorfg="$(xrdb -query | grep foreground: | awk '{print $2}')"
  10.  
  11. dmenu_args="-fn fixed:pixelsize=12:lang=ru -nb $colorbg -nf $colorfg -sb $colorfg -sf $colorbg"
  12.  
  13.  
  14. case $URI in
  15.     *.jp*g|*.png|*.gif) img "$URI" ;;
  16.     *.webm|*.mp4|*.ogv) mpv "$URI" ;;
  17.     *youtube.com/*) mpv "$URI" ;;
  18.     *.html) vimb "$URI" ;;
  19.     *.txt) st -e sh -c "curl -s '$URI'|less -R" ;;
  20.     *)  case $(echo "copy img text video web" | tr " " "\n" | dmenu $dmenu_args) in
  21.             copy) printf "%s" "$URI" | xsel -ib ;;
  22.             img) img "$URI" ;;
  23.             text) st -g "72x20" -e sh -c "curl -s '$URI'|less -R" ;;
  24.             video) mpv "$URI" ;;
  25.             web) vimb "$URI" ;;
  26.         esac ;;
  27. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement