Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2108 - (show annotations) (download) (as text)
Thu Jan 2 14:57:21 2014 UTC (10 years, 3 months ago) by niro
File MIME type: application/x-sh
File size: 1150 byte(s)
-create ~/.idesktop directory if missing
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 [ -d ~/.idesktop ] || install -d ~/.idesktop
44
45 cat > ~/.idesktop/sysinfo.lnk << EOF
46 table Icon
47 Caption: ${sysinfo}
48 Command: exit 0
49 Icon: /etc/alxconfig-ng/ica-sessions/icons/sysinfo.png
50 X: ${xpos}
51 Y: ${ypos}
52 Width: 1
53 Height: 1
54 end
55 EOF