Magellan Linux

Annotation of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-generate-all-desktop-icons.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2366 - (hide annotations) (download)
Tue Aug 25 10:28:00 2015 UTC (8 years, 8 months ago) by niro
File size: 2115 byte(s)
-restart idesk
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     ICON_SUFFIX="@@ICON_SUFFIX@@"
13    
14 niro 2360 die() { echo "ERROR: $@"; exit 1; }
15    
16 niro 2358 dest="${MCORE_UNPRIV_HOME}/.idesktop"
17     rc="${MCORE_UNPRIV_HOME}/.ideskrc"
18    
19     # progs path
20     progsh_path="${MCORE_UNPRIV_HOME}/.progs"
21    
22     # get the resolution
23     eval $(x11runas xinfo)
24     xres="${xorg_width}"
25     yres="${xorg_height}"
26    
27     # top left edge of the icon is given in config file
28     # remove a little bit to simulate the bottom-right edge
29     xres="$(( ${xres} - 120 ))"
30     yres="$(( ${yres} - 80 ))"
31    
32     # clean desktop icon location
33     [ -d ${dest} ] && rm -rf ${dest}
34     [ -f ${rc} ] && rm -f ${rc}
35     install -d ${dest}
36    
37     # default settings
38     declare -i x=50
39     declare -i y=50
40    
41     for icon_resource in $(find ${MROOT}/${MCORE_CONFIG_PATH}/icons/info -type f)
42     do
43     # abort if empty
44     [[ -z ${i} ]] && continue
45    
46     # new line if x > xres
47     if [ ${x} -ge ${xres} ]
48     then
49     x=50
50     y=$((${y} + 80))
51     fi
52    
53     # new row if y > yres
54     if [ ${y} -ge ${yres} ]
55     then
56     x=$((${x} + 120))
57     y=50
58    
59     # re-check x
60     [ ${x} -ge ${xres} ] && x=50
61     fi
62    
63     ${MCORE_LIBDIR}/idesk-generate-icon --resource "${icon_resource}" --xres "${x}" --yres "${y}"
64    
65     y=$((${y} + 80))
66     done
67    
68     # add shutdown, reboot icons
69     for i in shutdown reboot
70     do
71     # new line if x > xres
72     if [ ${x} -ge ${xres} ]
73     then
74     x=50
75     y=$((${y} + 80))
76     fi
77    
78     # new row if y > yres
79     if [ ${y} -ge ${yres} ]
80     then
81     x=$((${x} + 120))
82     y=50
83    
84     # re-check x
85     [ ${x} -ge ${xres} ] && x=50
86     fi
87    
88     case ${i} in
89     shutdown) name="Herunterfahren"; cmd="poweroff" ;;
90     reboot) name="Neustarten"; cmd="${i}" ;;
91     esac
92    
93     ${MCORE_LIBDIR}/idesk-generate-icon \
94     --name "${name}" \
95     --command "sudo /usr/sbin/${cmd}" \
96     --icon "${i}.png" \
97     --filename "${i}" \
98     --xres "${x}" \
99     --yres "${y}" \
100     --icon-width "40" \
101     --icon-height "40"
102    
103     y=$((${y} + 80))
104     done
105 niro 2366
106    
107     # restart idesk
108     killall idesk; x11runas "nohup idesk > /dev/null &"