sxmo_files: add "open in st" for current directory

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
master
Anjandev Momi 4 years ago committed by Maarten van Gompel
parent 30e8dfdc88
commit 358d79894e
  1. 5
      scripts/appscripts/sxmo_files.sh

@ -29,7 +29,7 @@ sort_loop() {
while true; do while true; do
# shellcheck disable=SC2086 # shellcheck disable=SC2086
FILES="$(ls -1p $SORT $REVERSE)" FILES="$(ls -1p $SORT $REVERSE)"
CHOICES="$(printf %b 'Reload\nClose Menu\nSort By\n../\n*\n'"$FILES")" CHOICES="$(printf %b 'Reload\nOpen in st\nClose Menu\nSort By\n../\n*\n'"$FILES")"
DIR="$(basename "$(pwd)")" DIR="$(basename "$(pwd)")"
TRUNCATED="$(printf %.7s "$DIR")" TRUNCATED="$(printf %.7s "$DIR")"
if [ "$DIR" != "$TRUNCATED" ]; then if [ "$DIR" != "$TRUNCATED" ]; then
@ -43,11 +43,12 @@ while true; do
)" || exit )" || exit
echo "$PICKED" | grep "Sort By" && sort_loop echo "$PICKED" | grep "Sort By" && sort_loop
echo "$PICKED" | grep "Open in st" && cd "$(pwd)" && st
echo "$PICKED" | grep "Close Menu" && exit 0 echo "$PICKED" | grep "Close Menu" && exit 0
echo "$PICKED" | grep "Reload" && continue echo "$PICKED" | grep "Reload" && continue
[ -d "$PICKED" ] && cd "$PICKED" && continue [ -d "$PICKED" ] && cd "$PICKED" && continue
echo "$PICKED" | grep -E '^[*]$' && sxmo_open.sh -a ./* echo "$PICKED" | grep -E '^[*]$' && sxmo_open.sh -a ./*
if [ -f "$PICKED" ]; then if [ -f "$PICKED" ] || [ "$PICKED" = "Open in st" ]; then
echo "$FILES" | sed -n -e "/$PICKED/,\$p" | tr '\n' '\0' | xargs -0 sxmo_open.sh -a echo "$FILES" | sed -n -e "/$PICKED/,\$p" | tr '\n' '\0' | xargs -0 sxmo_open.sh -a
fi fi
done done

Loading…
Cancel
Save