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