Annotation of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-sysinfo.in
Parent Directory | Revision Log
Revision 2119 -
(hide annotations)
(download)
Thu Jan 9 12:10:59 2014 UTC (10 years, 5 months ago) by niro
Original Path: mcore-src/trunk/mcore-tools/src/idesk-sysinfo.in
File size: 1128 byte(s)
Thu Jan 9 12:10:59 2014 UTC (10 years, 5 months ago) by niro
Original Path: mcore-src/trunk/mcore-tools/src/idesk-sysinfo.in
File size: 1128 byte(s)
-make pixmaps dir configurable
1 | niro | 2103 | #!/bin/bash |
2 | |||
3 | # die if no display was found | ||
4 | xinfo &> /dev/null || exit 1 | ||
5 | |||
6 | # eval xorg_width and xorg_height | ||
7 | eval $(xinfo) | ||
8 | |||
9 | # fallback | ||
10 | [[ -z ${xorg_width} ]] && xorg_width="1024" | ||
11 | [[ -z ${xorg_height} ]] && xorg_width="768" | ||
12 | |||
13 | if [ -e /etc/os-release ] | ||
14 | then | ||
15 | osversion=$(source /etc/os-release; echo "${ID}-${Version_ID}") | ||
16 | elif [ -e /etc/mageversion ] | ||
17 | then | ||
18 | osversion="alx-$(< /etc/mageversion)" | ||
19 | else | ||
20 | osversion="alx-UNKNOWN" | ||
21 | fi | ||
22 | |||
23 | if [[ -n $(type -P mcore-serial) ]] | ||
24 | then | ||
25 | serial="$(mcore-serial)" | ||
26 | else | ||
27 | serial="UNKNOWN" | ||
28 | fi | ||
29 | |||
30 | sysinfo="Hostname: $(hostname) Serial: #${serial} OS: ${osversion} Kernel: $(uname -r)" | ||
31 | #len_sysinfo="${#sysinfo}" | ||
32 | |||
33 | # calculate icon xpos | ||
34 | # xorg_width / 2 - len_sysinfo / 2 | ||
35 | #xpos="$(( ${xorg_width} / 2 - ${len_sysinfo} / 2 ))" | ||
36 | # xorg_width / 2 | ||
37 | xpos="$(( ${xorg_width} / 2 ))" | ||
38 | |||
39 | # calculate icon ypos | ||
40 | # xorg_height - text_height; text_height=22 pixel | ||
41 | ypos="$(( ${xorg_height} - 22))" | ||
42 | |||
43 | niro | 2108 | [ -d ~/.idesktop ] || install -d ~/.idesktop |
44 | |||
45 | niro | 2103 | cat > ~/.idesktop/sysinfo.lnk << EOF |
46 | table Icon | ||
47 | Caption: ${sysinfo} | ||
48 | Command: exit 0 | ||
49 | niro | 2119 | Icon: @@PIXMAPSDIR@@/sysinfo.png |
50 | niro | 2103 | X: ${xpos} |
51 | Y: ${ypos} | ||
52 | Width: 1 | ||
53 | Height: 1 | ||
54 | end | ||
55 | EOF |