Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2371 by niro, Wed Aug 26 11:08:26 2015 UTC revision 2415 by niro, Mon Aug 31 11:13:15 2015 UTC
# Line 19  rc="${MCORE_UNPRIV_HOME}/.ideskrc" Line 19  rc="${MCORE_UNPRIV_HOME}/.ideskrc"
19  # progs path  # progs path
20  progsh_path="${MCORE_UNPRIV_HOME}/.progs"  progsh_path="${MCORE_UNPRIV_HOME}/.progs"
21    
22    if [[ $(whoami) = ${MCORE_UNPRIV_USER} ]]
23    then
24     x11runas=""
25     sudo="sudo"
26    else
27     x11runas="x11runas"
28     sudo=""
29    fi
30    
31    RUN_IDESK=1
32    case $1 in
33     --no-startup|-n) RUN_IDESK=0 ;;
34    esac
35    
36  # get the resolution  # get the resolution
37  eval $(x11runas xinfo)  eval $(${x11runas} xinfo)
38  xres="${xorg_width}"  xres="${xorg_width}"
39  yres="${xorg_height}"  yres="${xorg_height}"
40    
41    # fallback to 1024x768
42    [[ -z ${xres} ]] && xres="1024"
43    [[ -z ${yres} ]] && xres="768"
44    
45  # top left edge of the icon is given in config file  # top left edge of the icon is given in config file
46  # remove a little bit to simulate the bottom-right edge  # remove a little bit to simulate the bottom-right edge
47  xres="$(( ${xres} - 120 ))"  xres="$(( ${xres} - 120 ))"
# Line 33  yres="$(( ${yres} - 80 ))" Line 51  yres="$(( ${yres} - 80 ))"
51  [ -d ${dest} ] && rm -rf ${dest}  [ -d ${dest} ] && rm -rf ${dest}
52  [ -f ${rc} ] && rm -f ${rc}  [ -f ${rc} ] && rm -f ${rc}
53  install -d ${dest}  install -d ${dest}
54    if [ -f /usr/share/idesk/dot.ideskrc ]
55    then
56     install -m0644 /usr/share/idesk/dot.ideskrc "${rc}"
57    fi
58    chown "${MCORE_UNPRIV_USER}":"${MCORE_UNPRIV_GROUP}" ${dest}
59    
60  # clean default reboot,shutdown icon info  # clean default reboot,shutdown,sysinfo icon info
61  for i in shutdown reboot  for i in shutdown reboot sysinfo
62  do  do
63   if [ -f ${MROOT}/${MCORE_CONFIG_PATH}/icons/info/${i}.${ICON_INFO_SUFFIX} ]   ${sudo} ${MCORE_LIBDIR}/idesk-generate-icon-info --del --name "${i}"
  then  
  rm ${MROOT}/${MCORE_CONFIG_PATH}/icons/info/${i}.${ICON_INFO_SUFFIX}  
  fi  
64  done  done
65    
66  # default settings  # default settings
# Line 69  do Line 89  do
89   [ ${x} -ge ${xres} ] && x=50   [ ${x} -ge ${xres} ] && x=50
90   fi   fi
91    
92   ${MCORE_LIBDIR}/idesk-generate-icon --resource "${icon_resource}" --xres "${x}" --yres "${y}"   ${MCORE_LIBDIR}/idesk-generate-icon --add --resource "${icon_resource}" --xpos "${x}" --ypos "${y}"
93    
94   y=$((${y} + 80))   y=$((${y} + 80))
95  done  done
# Line 99  do Line 119  do
119   reboot) name="Neustarten"; cmd="${i}" ;;   reboot) name="Neustarten"; cmd="${i}" ;;
120   esac   esac
121    
122   ${MCORE_LIBDIR}/idesk-generate-icon \   ${sudo} ${MCORE_LIBDIR}/idesk-generate-icon \
123     --add \
124   --name "${name}" \   --name "${name}" \
125   --command "sudo /usr/sbin/${cmd}" \   --command "sudo /usr/sbin/${cmd}" \
126   --icon "${i}.png" \   --icon "${i}.png" \
127   --filename "${i}" \   --filename "${i}" \
128   --xres "${x}" \   --xpos "${x}" \
129   --yres "${y}" \   --ypos "${y}" \
130   --icon-width "40" \   --icon-width "40" \
131   --icon-height "40"   --icon-height "40"
132    
133   y=$((${y} + 80))   y=$((${y} + 80))
134  done  done
135    
136  # restart idesk  # generate sysinfo
137  killall idesk; x11runas "nohup idesk > /dev/null &"  ${MCORE_LIBDIR}/idesk-sysinfo
138    ${MCORE_LIBDIR}/idesk-generate-icon --add \
139     --resource "${MROOT}/${MCORE_CONFIG_PATH}/icons/info/sysinfo.${ICON_INFO_SUFFIX}"
140    
141    if [[ ${RUN_IDESK} = 1 ]]
142    then
143     # restart idesk
144     if [[ -n $(pidof idesk) ]]
145     then
146     killall idesk
147     fi
148     if [[ -z ${x11runas} ]]
149     then
150     nohup idesk > /dev/null &
151     else
152     ${x11runas} "nohup idesk > /dev/null &"
153     fi
154    fi

Legend:
Removed from v.2371  
changed lines
  Added in v.2415