28dfdd5ae5
this setting is more user-config compliant
32 lines
820 B
Bash
Executable File
32 lines
820 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
######################################################################
|
|
# @author : swytch
|
|
# @file : dmenuopen
|
|
# @license : MIT
|
|
# @created : Wednesday May 20, 2020 18:08:05 CEST
|
|
#
|
|
# @description : find a file, open it with appropriate application
|
|
######################################################################
|
|
|
|
|
|
filetypes=".pdf .png .jpg .txt .mom .tex .mkv" # could be augmented
|
|
filetype=$(printf "$filetypes" | sed "s| |\n|g" | dmenu -i -p "type of the file?")
|
|
|
|
if [ -z "$filetype" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
file=$(find $HOME/ -type f | grep "$filetype" | dmenu -i -l 20 -p "open")
|
|
|
|
if [ -z "$file" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
case "$filetype" in
|
|
*.pdf) zathura "$file" ;;
|
|
*.png|.jpg) sxiv "$file" ;;
|
|
*.txt|*.mom|*.tex) "$TERMINAL" -e nvim "$file" ;;
|
|
*.mkv) mpv "$file";;
|
|
esac
|