Magellan Linux

Annotation of /mcore-src/trunk/mcore-tools/src/modules/fluxbox/fluxbox-menuitem.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2858 - (hide annotations) (download)
Wed Jul 15 06:38:15 2020 UTC (3 years, 9 months ago) by niro
File size: 1619 byte(s)
-always generate desktop icons if possible
1 niro 2277 #!/bin/bash
2    
3     MCORE_LIBDIR="@@MCORE_LIBDIR@@"
4     source @@SYSCONFDIR@@/mcore/mcore.conf
5     source ${MCORE_LIBDIR}/include/common.global.class
6    
7     MENUCONFDIR="${MCORE_CONFIG_PATH}/fluxbox/menu"
8    
9     die() { echo "ERROR: $@"; exit 1; }
10    
11     # very basic getops
12     for argv in $*
13     do
14     case $1 in
15     --add|--del|--print) method="${1//--}" ;;
16     --name) shift; name="$1" ;;
17     --exec) shift; exec="$1" ;;
18     --workdir) shift; workdir="$1" ;;
19     --icon) shift; icon="$1" ;;
20 niro 2281 --comment) shift; comment="$1" ;;
21 niro 2277 esac
22     shift
23     done
24    
25     [[ -n ${method} ]] || die "No method given"
26    
27     case "${method}" in
28     add)
29     [[ -n ${name} ]] || die "No name given"
30     [[ -n ${exec} ]] || die "No exec given"
31     CONFIG="${MROOT}/${MENUCONFDIR}/${name}"
32     clearconfig
33 niro 2281 [[ -n ${comment} ]] && addconfig "# ${comment}"
34 niro 2277 addconfig "[exec] (${name}) {${exec}}"
35 niro 2858
36     if [[ -n ${icon} ]]
37     then
38     if [[ -x ${MCORE_LIBDIR}/idesk-generate-icon-info ]]
39     then
40     # generate idesk desktop icon
41     ${MCORE_LIBDIR}/idesk-generate-icon-info --add --name "${name}" --command "${exec}" --icon "${icon}"
42     fi
43     fi
44 niro 2277 ;;
45    
46     del)
47     if [[ -n ${name} ]]
48     then
49     if [[ -f ${MROOT}/${MENUCONFDIR}/${name} ]]
50     then
51     rm ${MROOT}/${MENUCONFDIR}/"${name}"
52     fi
53 niro 2858 if [[ -x ${MCORE_LIBDIR}/idesk-generate-icon-info ]]
54     then
55     ${MCORE_LIBDIR}/idesk-generate-icon-info --del --name "${name}"
56     fi
57 niro 2277 else
58     # delete all items
59     find ${MROOT}/${MENUCONFDIR} -type f | xargs --no-run-if-empty rm
60 niro 2858 if [[ -x ${MCORE_LIBDIR}/idesk-generate-icon-info ]]
61     then
62     ${MCORE_LIBDIR}/idesk-generate-icon-info --del
63     fi
64 niro 2277 fi
65     ;;
66    
67     print) list_files_in_directory ${MROOT}/${MENUCONFDIR} ;;
68     esac