Advertisement
mosaid

mylocate.sh

Feb 28th, 2020
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.88 KB | None | 0 0
  1. #!/bin/bash
  2. lxterminal -e "locate /home /run/media |fzf > /tmp/mylocate_Data"
  3.  
  4. sleep 0.4
  5. while [[ -n "$(pidof fzf)" ]] ; do
  6.     sleep 0.4
  7. done
  8.  
  9. file="$(cat /tmp/mylocate_Data )"
  10. if [[ -z "$file" ]] ; then exit ; fi
  11. mimetype=$(file  --dereference --brief --mime-type  "$file" )
  12.  
  13. case "$mimetype" in
  14.     inode/directory)            lxterminal -e ranger "$file" ;;
  15.     image/gif)                  viewnior "$file" & disown ;;
  16.     image/*)                    feh "$file" & disown ;;
  17.     text/* | */xml)             lxterminal -e vim "$file"  ;;
  18.     video/* | audio/*)          mpv --force-window=yes  --really-quiet --loop "$file" & disown ;;
  19.     application/pdf)            okular "$file" & disown ;;
  20.     application/octet-stream)
  21.             if [[ "${file#*.}" == "MP3" ]]
  22.                 then
  23.                     mpv --really-quiet --loop "$file" & disown
  24.             fi
  25. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement