mb-jgtools/bin/places

40 lines
1018 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 ; }
2020-02-07 00:42:20 +01:00
for i in "$path"/*
2020-02-01 02:00:57 +01:00
do
test -e "$i" || continue
shortname=${i##*/}
if test -d "$i"
then
directories_menu="${directories_menu}
2020-02-07 00:42:20 +01:00
${shortname},^pipe(places \"${path}/${shortname}\")"
2020-02-01 02:00:57 +01:00
else
files_menu="$files_menu
2020-02-07 00:42:20 +01:00
${shortname},${JGMENU_RESOURCE_OPENER} \"${path}/${shortname}\""
2020-02-01 02:00:57 +01:00
fi
done
2020-02-02 17:51:13 +01:00
printf "%b\n" "^sep(<small><i>${path}</i></small>)"
2020-02-07 00:42:20 +01:00
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