FollieHiyuki-dotfiles/home/.local/bin/fzf/fzopen
2021-02-13 19:28:59 +03:00

12 lines
427 B
Bash
Executable File

#!/bin/sh
selected=$(fzf --no-multi --preview-window 'left:60%' --preview '$HOME/.local/bin/garbage/preview {} 2>/dev/null')
mimetype=$(file -b --mime-type "$selected")
case "$mimetype" in
*.doc|*.docx|*.odt|*.ott|*.xls|*.xlsx|*.xlsmx|*.ods|*.odp|*.sxc|*.ppt|*.pptx) libreoffice "$selected" & ;;
*.pdf) zathura "$selected" & ;;
text/* | */xml) $EDITOR "$selected" ;;
*) xdg-open "$selected" >/dev/null 2>&1 & ;;
esac