Annotation of /mcore-src/trunk/mcore-tools/src/modules/fluxbox/fluxbox-menuitem.in
Parent Directory | Revision Log
Revision 2281 -
(hide annotations)
(download)
Tue Jan 14 14:54:56 2014 UTC (10 years, 4 months ago) by niro
File size: 1116 byte(s)
Tue Jan 14 14:54:56 2014 UTC (10 years, 4 months ago) by niro
File size: 1116 byte(s)
-added --comment switch
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 | ;; | ||
36 | |||
37 | del) | ||
38 | if [[ -n ${name} ]] | ||
39 | then | ||
40 | if [[ -f ${MROOT}/${MENUCONFDIR}/${name} ]] | ||
41 | then | ||
42 | rm ${MROOT}/${MENUCONFDIR}/"${name}" | ||
43 | fi | ||
44 | else | ||
45 | # delete all items | ||
46 | find ${MROOT}/${MENUCONFDIR} -type f | xargs --no-run-if-empty rm | ||
47 | fi | ||
48 | ;; | ||
49 | |||
50 | print) list_files_in_directory ${MROOT}/${MENUCONFDIR} ;; | ||
51 | esac |