can open multiple files simultaneously now
This commit is contained in:
parent
f4e4a591b2
commit
1704fe27fe
@ -3,10 +3,10 @@
|
|||||||
#either via dmenu or fzf depending on the context
|
#either via dmenu or fzf depending on the context
|
||||||
ppid () { ps -p ${1:-$$} -o ppid=; }
|
ppid () { ps -p ${1:-$$} -o ppid=; }
|
||||||
shell="$(ps aux | grep $( ppid ) | head -n1 | awk '{print $11}' )"
|
shell="$(ps aux | grep $( ppid ) | head -n1 | awk '{print $11}' )"
|
||||||
document_dirs="$HOME/bks/* $HOME/eth/* $HOME/dox/*"
|
document_dirs="$HOME/bks/* $HOME/eth/* $HOME/dox/* $HOME/dls/*"
|
||||||
#force launch dmenu via cmd
|
#force launch dmenu via cmd
|
||||||
if [ "$1" = "launchdmenu" ]; then
|
if [ "$1" = "launchdmenu" ]; then
|
||||||
file="$( find $document_dirs -type f | sed "s|$HOME|~|"| dmenu -l 10 -p 'open what file?')"
|
file="$( find $document_dirs -type f | sed "s|$HOME|~|"| dmenu -i -l 10 -p 'open what file?')"
|
||||||
#/bin/sh means it's probably from dmenu_run (it's ugly but works)
|
#/bin/sh means it's probably from dmenu_run (it's ugly but works)
|
||||||
elif [ ! "$shell" = "/bin/sh" ]; then
|
elif [ ! "$shell" = "/bin/sh" ]; then
|
||||||
currentdir="$(pwd)"
|
currentdir="$(pwd)"
|
||||||
@ -17,23 +17,21 @@ elif [ ! "$shell" = "/bin/sh" ]; then
|
|||||||
if rifle -l "$path" | head -n1 | grep -q 'EDITOR';then
|
if rifle -l "$path" | head -n1 | grep -q 'EDITOR';then
|
||||||
rifle "$path"
|
rifle "$path"
|
||||||
else
|
else
|
||||||
rifle "$path" & disown
|
rifle "$path" &
|
||||||
fi
|
fi
|
||||||
cd "$currentdir" || exit
|
cd "$currentdir" || exit
|
||||||
exit
|
exit
|
||||||
#launch dmenu as it's probably in dmenu_run
|
#launch dmenu as it's probably in dmenu_run
|
||||||
else
|
else
|
||||||
file="$( find $document_dirs -type f | sed "s|$HOME|~|" | dmenu -l 10 -p 'open what file?' -it "$*" )"
|
file="$( find $document_dirs -type f | sed "s|$HOME|~|" | dmenu -i -l 10 -p 'open what file?' -it "$*" )"
|
||||||
fi
|
fi
|
||||||
#process selection if it's from dmenu
|
#process selection if it's from dmenu
|
||||||
[ -z "$file" ] && exit
|
[ -z "$file" ] && exit
|
||||||
path="$(echo "$file" | sed "s|\~|$HOME|")"
|
echo "$file" | sed "s|\~|$HOME|" |
|
||||||
echo "$path" |
|
|
||||||
while read -r pathfile; do
|
while read -r pathfile; do
|
||||||
cd "$( dirname "$pathfile" )" || exit
|
|
||||||
if rifle -l "$pathfile" | head -n1 | grep -q 'EDITOR';then
|
if rifle -l "$pathfile" | head -n1 | grep -q 'EDITOR';then
|
||||||
st rifle "$pathfile"
|
st rifle "$pathfile" &
|
||||||
else
|
else
|
||||||
rifle "$pathfile"
|
rifle "$pathfile" &
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user