-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdmenu_file.sh
executable file
·30 lines (27 loc) · 1.04 KB
/
dmenu_file.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
#
# a spotlight equivalent using dmenu
#
# depends on dmenu.
# Source generic dmenu
if [ -f $XDG_CONFIG_HOME/dmenu/dmenurc ]; then
. $XDG_CONFIG_HOME/dmenu/dmenurc
else
DMENU='dmenu -i -l 8'
fi
# Show options, get choice
choice=$((ls -laR ~/Scripts ~/Images ~/Downloads ~/.config/openbox ~/.config/tint2 ~/.config/libfm ~/.config/pcmanfm ~/.config/terminator && ls -la ~/ ls -al ~/.config) | grep ^- | awk '{print $9}' | sort -n | $DMENU -p "Files:")
if [[ $choice ]]; then
path=`locate $choice`
echo $path
ft=`xdg-mime query filetype $path`
if [[ $ft == "image/png" || $ft == "image/jpeg" || $ft == "image/jpg" || $ft == "image/bmp" ]]; then
gloobus-preview $path
elif [[ $ft == "application/pdf" ]]; then
evince $path
elif [[ $ft == "application/vnd.oasis.opendocument.presentation" || $ft == "application/vnd.oasis.opendocument.text" || $ft == "application/msword" ]]; then
libreoffice $path
else
terminator -e "nano $path"
fi
fi