Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/bin/idesk-sysinfo.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2103 - (show annotations) (download) (as text)
Thu Jan 2 09:56:27 2014 UTC (10 years, 3 months ago) by niro
File MIME type: application/x-sh
File size: 1104 byte(s)
-added initial idesk-sysinfo generator app
1 #!/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 cat > ~/.idesktop/sysinfo.lnk << EOF
44 table Icon
45 Caption: ${sysinfo}
46 Command: exit 0
47 Icon: /etc/alxconfig-ng/ica-sessions/icons/sysinfo.png
48 X: ${xpos}
49 Y: ${ypos}
50 Width: 1
51 Height: 1
52 end
53 EOF