aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/menu-scripts/ls.json.sh
blob: 754a10d4f4e33445c0e257474f70cea6d2074d5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
DIR=${1}
if [ "$1" = "" ] ; then
  DIR=`pwd`
fi

OUT="${OUT} \"   Open Directory\" : { \"type\" : \"item\", \"icon\":\"document-open\", \"action\" : \"xdg-open \\\"${DIR}\\\"\"}"
ls "${DIR}" > /tmp/.tmp.lines.$$ 
while read name
do
  OUT="${OUT},"
  if [ -d "${DIR}/${name}" ] ; then
    OUT="${OUT} \"${name}\" : { \"type\" : \"jsonmenu\", \"exec\" : \"${0} \\\"${DIR}/${name}\\\"\", \"icon\":\"folder\"}"
  else
    OUT="${OUT} \"${name}\" : { \"type\" : \"item\", \"icon\":\"unknown\", \"action\" : \"xdg-open \\\"${DIR}/${name}\\\"\"}"
  fi
done < /tmp/.tmp.lines.$$
rm /tmp/.tmp.lines.$$
echo "{ ${OUT} }"
bgstack15