mb-jgtools/bin/places

40 lines
1002 B
Plaintext
Raw Normal View History

2020-02-01 02:00:57 +01:00
#!/bin/sh
#
# Inspired by the {a,b}l-places-pipemenu scripts found in
# ArchLabs and BunsenLabs
#
: ${JGMENU_RESOURCE_OPENER=xdg-open}
path=${1:-$HOME}
path=${path%/}
test -d "$path" || { echo "$0: '$path' is not a directory" >&2 ; exit 1 ; }
for i in $path/*
do
test -e "$i" || continue
shortname=${i##*/}
if test -d "$i"
then
directories_menu="${directories_menu}
${shortname},^pipe(places '${path}/${shortname}')"
else
files_menu="$files_menu
${shortname},${JGMENU_RESOURCE_OPENER} ${path}/${shortname}"
fi
done
2020-02-02 17:51:13 +01:00
printf "%b\n" "^sep(<small><i>${path}</i></small>)"
printf "%b\n" "  Otwórz w menadżerze plików,${JGMENU_RESOURCE_OPENER} ${path}"
printf "%b\n" "  Otwórz w termianlu,terminator --working-directory=${path}"
2020-02-01 02:00:57 +01:00
printf "%b\n" "^sep()"
2020-02-02 17:51:13 +01:00
#printf "%b\n" "^sep(Katalogi)"
2020-02-01 02:00:57 +01:00
printf "%b\n" "${directories_menu}"
2020-02-02 17:51:13 +01:00
#printf "%b\n" "^sep(Pliki)"
2020-02-01 02:00:57 +01:00
printf "%b\n" "${files_menu}"
if test -z "${directories_menu}" && test -z "${files_menu}"
then
printf "%b\n" '<empty>'
fi