2020-02-08 09:36:18 +01:00
|
|
|
#!/usr/bin/env bash
|
2023-01-29 23:23:50 +01:00
|
|
|
# Daniel Napora 2020 - 2023 <napcok@gmail.com>
|
2022-09-20 23:14:27 +02:00
|
|
|
. "$HOME"/.config/mabox/mabox.conf
|
2021-01-12 01:28:26 +01:00
|
|
|
|
2020-02-17 17:14:08 +01:00
|
|
|
case $LANG in
|
|
|
|
pl*)
|
|
|
|
DIRECTORIES="Katalogi"
|
|
|
|
FILES="Pliki"
|
2023-01-29 23:23:50 +01:00
|
|
|
ADDBOOKMARK="Dodaj do zakładek"
|
2020-02-17 17:14:08 +01:00
|
|
|
OPENDIR="Otwórz w menadżerze plików"
|
|
|
|
OPENTERM="Otwórz w terminalu"
|
|
|
|
;;
|
2020-08-19 23:45:59 +02:00
|
|
|
es*)
|
|
|
|
DIRECTORIES="Directorios"
|
|
|
|
FILES="Archivos"
|
2023-01-29 23:23:50 +01:00
|
|
|
ADDBOOKMARK="Agregar a marcadores"
|
2020-08-19 23:45:59 +02:00
|
|
|
OPENDIR="Abrir Gestor de archivos aquí"
|
|
|
|
OPENTERM="Abrir terminal aquí"
|
|
|
|
;;
|
2020-02-17 17:14:08 +01:00
|
|
|
*)
|
|
|
|
DIRECTORIES="Directories"
|
|
|
|
FILES="Files"
|
2023-01-29 23:23:50 +01:00
|
|
|
ADDBOOKMARK="Add to Bookmarks"
|
2020-02-17 17:14:08 +01:00
|
|
|
OPENDIR="Open filemanager here"
|
|
|
|
OPENTERM="Open terminal here"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2021-10-02 23:57:01 +02:00
|
|
|
: "${JGMENU_RESOURCE_OPENER="xdg-open"}"
|
|
|
|
|
2020-02-08 09:36:18 +01:00
|
|
|
|
|
|
|
DIRECTORY=${1:-$HOME}
|
|
|
|
|
2020-02-09 16:52:47 +01:00
|
|
|
# If '$DIRECTORY' is '/', unset it to avoid '//'.
|
2020-02-08 09:36:18 +01:00
|
|
|
[[ $DIRECTORY == / ]] && DIRECTORY=
|
|
|
|
|
2021-10-02 23:57:01 +02:00
|
|
|
if [ "$jgbrowser_show_hidden" == false ];then
|
2020-02-08 09:36:18 +01:00
|
|
|
for item in "$DIRECTORY"/*; do
|
|
|
|
if [[ -d $item ]]; then
|
|
|
|
dirs+=("${item##*/},^pipe(jgbrowser \"$DIRECTORY/${item##*/}\")")
|
|
|
|
else
|
2020-02-09 16:52:47 +01:00
|
|
|
if [[ -f $item ]]; then
|
2020-02-08 09:36:18 +01:00
|
|
|
files+=("${item##*/},xdg-open \"$DIRECTORY/${item##*/}\"")
|
|
|
|
fi
|
2020-02-09 16:52:47 +01:00
|
|
|
fi
|
2020-02-08 09:36:18 +01:00
|
|
|
done
|
2020-10-09 13:04:56 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
for item in "$DIRECTORY"/* "$DIRECTORY"/.[^.]*; do
|
|
|
|
if [[ -d $item ]]; then
|
|
|
|
dirs+=("${item##*/},^pipe(jgbrowser \"$DIRECTORY/${item##*/}\")")
|
|
|
|
else
|
|
|
|
if [[ -f $item ]]; then
|
|
|
|
files+=("${item##*/},xdg-open \"$DIRECTORY/${item##*/}\"")
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2020-02-09 16:52:47 +01:00
|
|
|
printf "%b\n" "^sep(<small><i>${DIRECTORY:-/}</i></small>)"
|
2023-01-29 23:23:50 +01:00
|
|
|
printf "%b\n" " ${ADDBOOKMARK},\"\"\"echo \" ${DIRECTORY##*/},^pipe(jgbrowser ${DIRECTORY:-/})\" >> $HOME/.config/mabox/places.csv;mb-places -s\"\"\""
|
|
|
|
printf "%b\n" "^sep()"
|
2021-01-12 01:28:26 +01:00
|
|
|
printf "%b\n" " $OPENDIR,${JGMENU_RESOURCE_OPENER} \"${DIRECTORY:-/}\""
|
|
|
|
printf "%b\n" "<big></big> $OPENTERM,exo-open --launch TerminalEmulator --working-directory=\"${DIRECTORY:-/}\""
|
|
|
|
#printf "%b\n" " $OPENTERM,terminator --working-directory=\"${DIRECTORY:-/}\""
|
2020-02-09 16:52:47 +01:00
|
|
|
if [ ${#dirs[@]} -ne 0 ]; then
|
2021-01-12 01:28:26 +01:00
|
|
|
printf "%b\n" "^sep($DIRECTORIES <small>(${#dirs[@]})</small>)"
|
2021-01-16 16:03:30 +01:00
|
|
|
printf "%s\n" "${dirs[@]/&/&}"
|
2020-02-09 16:52:47 +01:00
|
|
|
fi
|
|
|
|
if [ ${#files[@]} -ne 0 ]; then
|
2021-01-12 01:28:26 +01:00
|
|
|
printf "%b\n" "^sep($FILES <small>(${#files[@]})</small>)"
|
2021-01-16 16:03:30 +01:00
|
|
|
#printf "%s\n" "${files[@]}"
|
|
|
|
#okfiles=("${files[@]/</ <}")
|
|
|
|
printf "%s\n" "${files[@]/&/&}"
|
2020-02-09 16:52:47 +01:00
|
|
|
fi
|
2021-01-16 16:03:30 +01:00
|
|
|
|