Magellan Linux

Annotation of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-generate-icon-info.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2358 - (hide annotations) (download)
Tue Aug 25 09:51:46 2015 UTC (8 years, 8 months ago) by niro
File size: 1612 byte(s)
-basic idesk helpers
1 niro 2358 #!/bin/bash
2    
3     MCORE_LIBDIR="@@MCORE_LIBDIR@@"
4     source @@SYSCONFDIR@@/mcore/mcore.conf
5     source ${MCORE_LIBDIR}/include/common.global.class
6    
7     GLOBAL_PIXMAPS_PATH="@@GLOBAL_PIXMAPS_PATH@@"
8     LOCAL_PIXMAPS_PATH="${MCORE_CONFIG_PATH}/icons/default"
9    
10     ICON_INFO_PATH="${MCORE_CONFIG_PATH}/icons/info"
11     ICON_INFO_SUFFIX="@@ICON_INFO_SUFFIX@@"
12    
13     # very basic getops
14     for i in $*
15     do
16     case $1 in
17     --name|-n) shift; name="$1" ;;
18     --command|-c) shift; command="$1" ;;
19     --icon|-i) shift; icon="$1" ;;
20     --filename|-f) shift; filename="$1" ;;
21     --xres|-x) shift; xres="$1" ;;
22     --yres|-y) shift; yres="$1" ;;
23     --icon-width|-w) shift; iwidth="$1" ;;
24     --icon-height|-h) shift; iheight="$1" ;;
25     --default-icon) shift; deficon="$1" ;;
26     esac
27     shift
28     done
29    
30     # some sanity checks:
31    
32     # abort if name or command not given
33     [[ -z ${name} ]] && die "No name given"
34     [[ -z ${command} ]] && die "No command given"
35    
36     [[ -z ${filename} ]] && filename="${name}"
37    
38     # use some defaults for icon, dest, {x,y}res
39     [[ -z ${xres} ]] && xres=50
40     [[ -z ${yres} ]] && xres=50
41     if [[ -z ${icon} ]]
42     then
43     # if no default icon is given use default.png
44     [[ -z ${deficon} ]] && deficon="default.png"
45     icon="${deficon}"
46     fi
47    
48     CONFIG="${ICON_INFO_PATH}/${filename}.${ICON_INFO_SUFFIX}"
49     clearconfig
50    
51     addconfig "name=\"${name}\""
52     addconfig "command=\"${command}\""
53     addconfig "icon=\"${icon}\""
54     addconfig "deficon=\"${deficon}\""
55     addconfig "xres=\"${xres}\""
56     addconfig "yres=\"${yres}\""
57     if [[ -z ${iwidth} ]]
58     then
59     addconfig "iwidth=0"
60     else
61     addconfig "iwidth=\"${iwidth}\""
62     fi
63    
64     if [[ ! -z ${iheight} ]]
65     then
66     addconfig="iheight=0"
67     else
68     addconfig "iheight=\"${iheight}\""
69     fi