diff options
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/command_output/README | 5 | ||||
-rwxr-xr-x | widgets/command_output/command | 6 | ||||
-rw-r--r-- | widgets/system_information/README | 12 | ||||
l--------- | widgets/system_information/system_information | 1 | ||||
-rwxr-xr-x | widgets/system_information/system_information.ubuntu | 134 | ||||
-rw-r--r-- | widgets/system_updatestatus/README | 8 | ||||
-rwxr-xr-x | widgets/system_updatestatus/system_update_status | 17 | ||||
-rwxr-xr-x | widgets/system_updatestatus/system_update_status.ubuntu | 62 | ||||
-rw-r--r-- | widgets/temperatures/README | 7 | ||||
-rwxr-xr-x | widgets/temperatures/temperatures | 22 |
10 files changed, 274 insertions, 0 deletions
diff --git a/widgets/command_output/README b/widgets/command_output/README new file mode 100644 index 00000000..f73a0326 --- /dev/null +++ b/widgets/command_output/README @@ -0,0 +1,5 @@ +This widget is for an own command +The command "command" will be executed every time the widget is drawn, so please keep it short and fast. +The command have to provide two output files: "title" and "output". +"title" is the title of the Widget. +The "output" file is read line by line. And every line is drawn without wrap the lines if they are to long. diff --git a/widgets/command_output/command b/widgets/command_output/command new file mode 100755 index 00000000..03b12b23 --- /dev/null +++ b/widgets/command_output/command @@ -0,0 +1,6 @@ +#!/bin/bash + +echo "MyTitle" > title + +echo "output line 1" > output +echo "output line 2" >> output diff --git a/widgets/system_information/README b/widgets/system_information/README new file mode 100644 index 00000000..946b5236 --- /dev/null +++ b/widgets/system_information/README @@ -0,0 +1,12 @@ +This widget provides several information about the current system state. + +The command "system_information" will be executed every time the widget is drawn, so please keep it short and fast. +The command "system_information" must provide several files with the infos. +The output files must begin with 01_ - 99_ for sort/position the info in the widget. For example "01_uptime", "02_load", etc.The values will be drawn in 2 columns except "system_version" and "kernel_version" they are drawn in a row. +For example: +System Version: Ubuntu 14.04.1 LTS +Load: 0.32 Uptime: 10:24:42 up 88 days + +You can include system_updatestatus and temperatures. But do not execute the system_updatestatus script (please read README of system_updatestatus) + +Please see the example!
\ No newline at end of file diff --git a/widgets/system_information/system_information b/widgets/system_information/system_information new file mode 120000 index 00000000..d61d4dfb --- /dev/null +++ b/widgets/system_information/system_information @@ -0,0 +1 @@ +system_information.ubuntu
\ No newline at end of file diff --git a/widgets/system_information/system_information.ubuntu b/widgets/system_information/system_information.ubuntu new file mode 100755 index 00000000..4222b602 --- /dev/null +++ b/widgets/system_information/system_information.ubuntu @@ -0,0 +1,134 @@ +#!/bin/bash + +# this script will be executed when the widget will be drawn +# so make it short and fast + +# enable/disable items +SHOW_SYS_VERSION=0 +SHOW_KERNEL_VERSION=0 +SHOW_UPTIME=1 +SHOW_LOAD=1 +SHOW_PROCESSES=1 +SHOW_MEM_USAGE=1 +SHOW_SWAP_USAGE=1 +SHOW_ROOT_USAGE=1 +SHOW_VIDEO_USAGE=1 +SHOW_VDR_CPU_USAGE=1 +SHOW_VDR_MEM_USAGE=1 + +SHOW_TEMPERATURES=0 +SHOW_SYSUPDATES=0 + +# Position of items +# sys_version & kernel_version are drawn in one line +# all others will be drawn in two column +# for example +# System Version: Ubuntu 14.04.1 LTS +# Uptime: 1:20 5m Load: 0.41 + +# must begin with 01 +SYS_VERSION_POS="01" +KERNEL_VERSION_POS="02" +UPTIME_POS="03" +LOAD_POS="04" +PROCESSES_POS="05" +MEM_USAGE_POS="06" +SWAP_USAGE_POS="07" +ROOT_USAGE_POS="08" +VIDEO_USAGE_POS="09" +VDR_CPU_USAGE_POS="10" +VDR_MEM_USAGE_POS="11" + +TEMP_CPU_POS=15 +TEMP_PCCASE_POS=16 +TEMP_GPU_POS=17 + +SYSUPD_POS=20 +SYSSECUPD_POS=21 + +# mount point of vdr video disk +VIDEO_MOUNT="/media/video" + + +# force english output for filters +LANG=en_EN + +# delete all files +rm -f [0-99]* + +if [ $SHOW_SYS_VERSION = 1 ]; then + cat /etc/os-release | grep "PRETTY_NAME=" | cut -d"\"" -f 2 > ./${SYS_VERSION_POS}_sys_version +fi + +if [ $SHOW_KERNEL_VERSION = 1 ]; then + uname -r > ./${KERNEL_VERSION_POS}_kernel_version +fi + +if [ $SHOW_UPTIME = 1 ]; then + uptime | grep -ohe 'up .*' | sed 's/,//g' | awk '{ printf $2" "$3 }' > ./${UPTIME_POS}_uptime +fi + +if [ $SHOW_LOAD = 1 ]; then + cat /proc/loadavg | awk '{print $1}' > ./${LOAD_POS}_load +fi + +if [ $SHOW_PROCESSES = 1 ]; then + ps aux | wc -l > ./${PROCESSES_POS}_processes +fi + +if [ $SHOW_MEM_USAGE = 1 ]; then + free -m | awk '/Mem:/ { total=$2 } /buffers\/cache/ { used=$3 } END { printf("%3.1f%%", used/total*100)}' > ./${MEM_USAGE_POS}_mem_usage +fi + +if [ $SHOW_SWAP_USAGE = 1 ]; then + SWAP=`free -m | awk '/Swap/ {print($2)}'` + if [ $SWAP -gt 0 ]; then + free -m | awk '/Swap/ { printf("%3.1f%%", $3/$2*100) }' > ./${SWAP_USAGE_POS}_swap_usage + fi +fi + +if [ $SHOW_ROOT_USAGE = 1 ]; then + df -h / | awk '/\// {print $(NF-1)}' > ./${ROOT_USAGE_POS}_root_usage +fi + +if [ $SHOW_VIDEO_USAGE = 1 ] && [ -d ${VIDEO_MOUNT} ]; then + df -h ${VIDEO_MOUNT} | awk '/\// {print $(NF-1)}' > ./${VIDEO_USAGE_POS}_video_usage +fi + +if [ $SHOW_VDR_CPU_USAGE = 1 ]; then + vdr_pid=`pidof vdr` + if [ $? = 0 ]; then + VALUE=`ps -p ${vdr_pid} -o %cpu | awk 'NR==2{print $0}' | tr -d ' '` + echo "${VALUE}%" > ./${VDR_CPU_USAGE_POS}_vdr_cpu_usage + fi +fi + +if [ $SHOW_VDR_MEM_USAGE = 1 ]; then + vdr_pid=`pidof vdr` + if [ $? = 0 ]; then + VALUE=`ps -p ${vdr_pid} -o %mem | awk 'NR==2{print $0}' | tr -d ' '` + echo "${VALUE}%" > ./${VDR_MEM_USAGE_POS}_vdr_mem_usage + fi +fi + +if [ $SHOW_TEMPERATURES = 1 ]; then + ./../temperatures/temperatures + if [ -f ./cpu ]; then + mv ./cpu ${TEMP_CPU_POS}_cpu + fi + if [ -f ./pccase ]; then + mv ./pccase ${TEMP_PCCASE_POS}_pccase + fi + if [ -f ./gpu ]; then + mv ./gpu ${TEMP_GPU_POS}_gpu + fi +fi + +if [ $SHOW_SYSUPDATES = 1 ]; then + if [ -f ./../system_updatestatus/updates ]; then + cp ./../system_updatestatus/updates ${SYSUPD_POS}_updates + fi + if [ -f ./../system_updatestatus/security_updates ]; then + cp ./../system_updatestatus/security_updates ${SYSSECUPD_POS}_security_updates + fi +fi diff --git a/widgets/system_updatestatus/README b/widgets/system_updatestatus/README new file mode 100644 index 00000000..3bcf7289 --- /dev/null +++ b/widgets/system_updatestatus/README @@ -0,0 +1,8 @@ +This widget provide information about available updates of the system. + +Since the command usually needs long time to execute this is not called from skin flatPlus. +You have to call the command from the system via cron or at system start. +For example call the command from cron.daily. + +The command can provide to output files: "updates" and "security_updates". The file "security_updates" is optional. + diff --git a/widgets/system_updatestatus/system_update_status b/widgets/system_updatestatus/system_update_status new file mode 100755 index 00000000..50bdc037 --- /dev/null +++ b/widgets/system_updatestatus/system_update_status @@ -0,0 +1,17 @@ +#!/bin/bash + +APTCHECK=/usr/lib/update-notifier/apt-check + +rm -f updates security_updates + +if [ ! -f ${APTCHECK} ] +then + exit +fi + +RET=$(${APTCHECK} 2>&1) + +# updates +echo $RET | cut -d";" -f1 > updates +# security updates +echo $RET | cut -d";" -f2 > security_updates diff --git a/widgets/system_updatestatus/system_update_status.ubuntu b/widgets/system_updatestatus/system_update_status.ubuntu new file mode 100755 index 00000000..23f4345a --- /dev/null +++ b/widgets/system_updatestatus/system_update_status.ubuntu @@ -0,0 +1,62 @@ +#!/bin/bash + +# this script must be call from cron +# please add a cron entry for this script +# skin flatPlus only read the file "update_status" + + +rm -f ./update_status + +# lent code from apticron, thank you! + +# Set $DIRCACHE +eval `/usr/bin/apt-config shell DIRCACHE Dir::Cache` + +NOTIFY_HOLDS="0" +NOTIFY_NEW="1" + +# get the list of packages which are pending an upgrade +PKGNAMES=`/usr/bin/apt-get -q -y --ignore-hold --allow-unauthenticated -s dist-upgrade | \ + /bin/grep ^Inst | /usr/bin/cut -d\ -f2 | /usr/bin/sort` + +# creating the future last_run file +TMPFILE="$(mktemp -t apticron.XXXXXXXXXX)" +for p in $PKGNAMES; do + echo $p >> $TMPFILE +done + +# workaround to handle apt-get installing packages hold by aptitude. See #137771. +APTITUDE_HOLDS=`grep "^State: 2" -B 2 /var/lib/aptitude/pkgstates 2>/dev/null |grep "^Package: .*$" |cut -d" " -f 2` +DSELECT_HOLDS=`dpkg --get-selections |grep "hold$" |cut -f1` + +if [ "$NOTIFY_HOLDS" = "0" ]; then + # packages hold by aptitude don't go to the upgrading candidates list + for p in $APTITUDE_HOLDS; do + PKGNAMES=`echo $PKGNAMES |sed "s/\(^\| \)$p\( \|$\)/ /g;s/^ //g"` + done + # packages hold by dselect don't go to the upgrading candidates list + for p in $DSELECT_HOLDS; do + PKGNAMES=`echo $PKGNAMES |sed "s/\(^\| \)$p\( \|$\)/ /g;s/^ //g"` + done +fi + +if [ "$NOTIFY_NEW" = "0" ]; then + # new packages don't go to the upgrading candidates list (see #531002) + for p in $PKGNAMES; do + if [ -z "`dpkg -s $p 2>/dev/null| grep '^Status: install ok installed'`" ] ; then + PKGNAMES=`echo $PKGNAMES |sed "s/\(^\| \)$p\( \|$\)/ /g;s/^ //g"` + fi + done +fi + + +PKGPATH="/${DIRCACHE}archives/" +for PKG in $PKGNAMES ; do + VER=`LC_ALL=C /usr/bin/apt-cache policy $PKG | /bin/grep Candidate: | /usr/bin/cut -f 4 -d \ ` + VERFILE=`echo "$VER" | /bin/sed -e "s/:/%3a/g"` + if ls ${PKGPATH}${PKG}_${VERFILE}_*.deb >& /dev/null ; then + DEBS="$DEBS ${PKGPATH}${PKG}_${VERFILE}_*.deb" + fi + echo $PKG $VER >> ./update_status +done + diff --git a/widgets/temperatures/README b/widgets/temperatures/README new file mode 100644 index 00000000..fc2247a8 --- /dev/null +++ b/widgets/temperatures/README @@ -0,0 +1,7 @@ +This Widget provide information about the system temperatures. + +The command "temperatures" will be executed every time the widget is drawn, so please keep it short and fast. +The command can provide three temperatures: cpu, pc case and gpu temperature +The command can also be called from system information widget. So the output files must also begin with 01_ - 99_ for sort/position. + +Please install lm-sensors and configure it for your system. See the default script for an example. diff --git a/widgets/temperatures/temperatures b/widgets/temperatures/temperatures new file mode 100755 index 00000000..75a35796 --- /dev/null +++ b/widgets/temperatures/temperatures @@ -0,0 +1,22 @@ +#!/bin/bash + +# please update this script to fit your needs +# this script is call every time the widget will be drawn, so keep it short and fast ;) + +# if the script is executed from system_information script set the locale back for "°C" +LANG=de_DE.UTF-8 + +# there can be 3 files, cpu, gpu, case + +rm -f ./cpu ./pccase ./gpu + +# intel core-i cpu temp +sensors -A coretemp-isa-0000 | grep "Core 0" | awk '{print $3}' | tr -d "+" > ./cpu + +# pc case temp +sensors -A acpitz-virtual-0 | grep "temp1" | awk '{print $2}' | tr -d "+" > ./pccase + +# nvidia gpu temp +# nvidia-settings must be run as the user of the x server +GPU=`nvidia-settings -c :0 -t -query GPUCoreTemp | head -n 1` +echo "$GPU°C" > ./gpu |