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
#either via dmenu or fzf depending on the context
ppid () { ps -p ${1:-$$} -o ppid=; }
@ -27,10 +27,13 @@ else
fi
#process selection if it's from dmenu
[ -z "$file" ] && exit
path="$(printf '%s%s' "$HOME" "${file//\~/}")"
cd "$( dirname "$path" )" || exit
if rifle -l "$path" | head -n1 | grep -q 'EDITOR';then
st rifle "$path"
else
rifle "$path"
fi
path="$(echo "$file" | sed "s|\~|$HOME|")"
echo "$path" |
while read -r pathfile; do
cd "$( dirname "$pathfile" )" || exit
if rifle -l "$pathfile" | head -n1 | grep -q 'EDITOR';then
st rifle "$pathfile"
else
rifle "$pathfile"
fi
done