added multiselection support to de

This commit is contained in:
Alexander Bocken 2021-01-02 17:16:52 +01:00
parent 6880d648c6
commit 79c9a24006
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
#A script that launches documents in their respective viewers #A script that launches documents in their respective viewers
#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=; }
@ -27,10 +27,13 @@ else
fi fi
#process selection if it's from dmenu #process selection if it's from dmenu
[ -z "$file" ] && exit [ -z "$file" ] && exit
path="$(printf '%s%s' "$HOME" "${file//\~/}")" path="$(echo "$file" | sed "s|\~|$HOME|")"
cd "$( dirname "$path" )" || exit echo "$path" |
if rifle -l "$path" | head -n1 | grep -q 'EDITOR';then while read -r pathfile; do
st rifle "$path" cd "$( dirname "$pathfile" )" || exit
else if rifle -l "$pathfile" | head -n1 | grep -q 'EDITOR';then
rifle "$path" st rifle "$pathfile"
fi else
rifle "$pathfile"
fi
done