Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2277 - (show annotations) (download)
Tue Jan 14 14:36:04 2014 UTC (10 years, 4 months ago) by niro
File size: 1030 byte(s)
-split of fluxbox-menuitem from fluxbox.client.class.in to make things more modular
1 #!/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 esac
21 shift
22 done
23
24 [[ -n ${method} ]] || die "No method given"
25
26 case "${method}" in
27 add)
28 [[ -n ${name} ]] || die "No name given"
29 [[ -n ${exec} ]] || die "No exec given"
30 CONFIG="${MROOT}/${MENUCONFDIR}/${name}"
31 clearconfig
32 addconfig "[exec] (${name}) {${exec}}"
33 ;;
34
35 del)
36 if [[ -n ${name} ]]
37 then
38 if [[ -f ${MROOT}/${MENUCONFDIR}/${name} ]]
39 then
40 rm ${MROOT}/${MENUCONFDIR}/"${name}"
41 fi
42 else
43 # delete all items
44 find ${MROOT}/${MENUCONFDIR} -type f | xargs --no-run-if-empty rm
45 fi
46 ;;
47
48 print) list_files_in_directory ${MROOT}/${MENUCONFDIR} ;;
49 esac