From f71077e871218abd105027d1eb6b9b4033fbe131 Mon Sep 17 00:00:00 2001 From: Martin Schirrmacher Date: Mon, 17 Nov 2014 19:27:30 +0100 Subject: update widgets files; add weather widget font size --- widgets/command_output/README | 5 +- widgets/command_output/command | 6 -- widgets/command_output/command.example | 6 ++ widgets/system_information/README | 5 +- widgets/system_information/system_information | 1 - widgets/system_information/system_information.g2v | 2 +- widgets/system_updatestatus/system_update_status | 17 ------ .../system_update_status.ubuntu | 65 ++++------------------ widgets/temperatures/README | 3 + widgets/temperatures/temperatures | 25 --------- widgets/temperatures/temperatures.default | 25 +++++++++ widgets/weather/GetLatLangFromCity.php | 4 +- widgets/weather/README | 6 +- widgets/weather/update_weather.config | 17 ------ widgets/weather/update_weather.config.sample | 23 ++++++++ widgets/weather/update_weather.php | 2 +- 16 files changed, 83 insertions(+), 129 deletions(-) delete mode 100755 widgets/command_output/command create mode 100755 widgets/command_output/command.example delete mode 120000 widgets/system_information/system_information delete mode 100755 widgets/system_updatestatus/system_update_status delete mode 100755 widgets/temperatures/temperatures create mode 100755 widgets/temperatures/temperatures.default delete mode 100644 widgets/weather/update_weather.config create mode 100644 widgets/weather/update_weather.config.sample (limited to 'widgets') diff --git a/widgets/command_output/README b/widgets/command_output/README index f73a0326..1e949b02 100644 --- a/widgets/command_output/README +++ b/widgets/command_output/README @@ -1,5 +1,6 @@ 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. +"title" is the title for the widget. +The "output" file is read line by line. And every line is drawn without wrap the line if it is to long. diff --git a/widgets/command_output/command b/widgets/command_output/command deleted file mode 100755 index 03b12b23..00000000 --- a/widgets/command_output/command +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -echo "MyTitle" > title - -echo "output line 1" > output -echo "output line 2" >> output diff --git a/widgets/command_output/command.example b/widgets/command_output/command.example new file mode 100755 index 00000000..03b12b23 --- /dev/null +++ b/widgets/command_output/command.example @@ -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 index 946b5236..03ea2b22 100644 --- a/widgets/system_information/README +++ b/widgets/system_information/README @@ -1,5 +1,8 @@ This widget provides several information about the current system state. +You must manually create a link to the corresponding script, for example: +ln -s system_information.ubuntu system + 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. @@ -9,4 +12,4 @@ 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 +Please see the example! diff --git a/widgets/system_information/system_information b/widgets/system_information/system_information deleted file mode 120000 index d61d4dfb..00000000 --- a/widgets/system_information/system_information +++ /dev/null @@ -1 +0,0 @@ -system_information.ubuntu \ No newline at end of file diff --git a/widgets/system_information/system_information.g2v b/widgets/system_information/system_information.g2v index 56480fa3..c0905624 100755 --- a/widgets/system_information/system_information.g2v +++ b/widgets/system_information/system_information.g2v @@ -12,7 +12,7 @@ SHOW_PROCESSES=1 SHOW_MEM_USAGE=1 SHOW_SWAP_USAGE=1 SHOW_ROOT_USAGE=1 -SHOW_VIDEO_USAGE=1 +SHOW_VIDEO_USAGE=0 SHOW_VDR_CPU_USAGE=1 SHOW_VDR_MEM_USAGE=1 diff --git a/widgets/system_updatestatus/system_update_status b/widgets/system_updatestatus/system_update_status deleted file mode 100755 index 50bdc037..00000000 --- a/widgets/system_updatestatus/system_update_status +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 index 23f4345a..50bdc037 100755 --- a/widgets/system_updatestatus/system_update_status.ubuntu +++ b/widgets/system_updatestatus/system_update_status.ubuntu @@ -1,62 +1,17 @@ #!/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" +APTCHECK=/usr/lib/update-notifier/apt-check +rm -f updates security_updates -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 +if [ ! -f ${APTCHECK} ] +then + exit 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 +RET=$(${APTCHECK} 2>&1) +# updates +echo $RET | cut -d";" -f1 > updates +# security updates +echo $RET | cut -d";" -f2 > security_updates diff --git a/widgets/temperatures/README b/widgets/temperatures/README index fc2247a8..5f22c359 100644 --- a/widgets/temperatures/README +++ b/widgets/temperatures/README @@ -1,5 +1,8 @@ This Widget provide information about the system temperatures. +You must manually create a link to the corresponding script, for example: +ln -s temperatures.default 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. diff --git a/widgets/temperatures/temperatures b/widgets/temperatures/temperatures deleted file mode 100755 index be764be0..00000000 --- a/widgets/temperatures/temperatures +++ /dev/null @@ -1,25 +0,0 @@ -#!/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 4 files, cpu, gpu, pccase, motherboard - -rm -f ./cpu ./pccase ./gpu ./motherboard - -# 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 - -# motherboard temp -sensors -A acpitz-virtual-0 | grep "temp1" | awk '{print $2}' | tr -d "+" > ./motherboard - -# 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 diff --git a/widgets/temperatures/temperatures.default b/widgets/temperatures/temperatures.default new file mode 100755 index 00000000..be764be0 --- /dev/null +++ b/widgets/temperatures/temperatures.default @@ -0,0 +1,25 @@ +#!/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 4 files, cpu, gpu, pccase, motherboard + +rm -f ./cpu ./pccase ./gpu ./motherboard + +# 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 + +# motherboard temp +sensors -A acpitz-virtual-0 | grep "temp1" | awk '{print $2}' | tr -d "+" > ./motherboard + +# 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 diff --git a/widgets/weather/GetLatLangFromCity.php b/widgets/weather/GetLatLangFromCity.php index e05c1bc8..1ca7d1e3 100644 --- a/widgets/weather/GetLatLangFromCity.php +++ b/widgets/weather/GetLatLangFromCity.php @@ -18,8 +18,8 @@ if( !isset($data['results'][0]) ) { $latitude = $data['results'][0]['geometry']['location']['lat']; $longitude = $data['results'][0]['geometry']['location']['lng']; -echo "latitude: ".$latitude."\n"; -echo "longitude: ".$longitude."\n"; +echo "Latitude = ".$latitude."\n"; +echo "Longitude = ".$longitude."\n"; echo "put these values in update_weather.config\n"; ?> diff --git a/widgets/weather/README b/widgets/weather/README index 956c7a26..af7f985e 100644 --- a/widgets/weather/README +++ b/widgets/weather/README @@ -6,4 +6,8 @@ For example call the command from cron.daily. You need php5 with command line support for this widget. For example in Ubuntu you need the package "php5-cli". -Please configur your location and others in update_weather.config. Use php-script "GetLatLangFromCity.php" to get latitude & longitude from your location. +Please move update_weather.config to update_weather.config.sample + +mv update_weather.config.sample update_weather.config + +Configure your location and others in update_weather.config. Use php-script "GetLatLangFromCity.php" to get latitude & longitude from your location. diff --git a/widgets/weather/update_weather.config b/widgets/weather/update_weather.config deleted file mode 100644 index f799c6d3..00000000 --- a/widgets/weather/update_weather.config +++ /dev/null @@ -1,17 +0,0 @@ -[main] -# use GetLatLangFromCity.php to get latitude/langitude -Latitude = 52.5200066 -Longitude = 13.404954 -# location shown in Skin -LocationSkin = "Berlin" -# Can be set to 'us', 'si', 'ca', 'uk' or 'auto' (see forecast.io API); default is auto -Units = "si" -DegreeSign = "°C" -# Can be set to 'en', 'de', 'pl', 'es', 'fr', 'it', 'tet' or 'x-pig-latin' (see forecast.io API); default is 'en' -Lang = "de" -# convert . to , for german format -ConvertPoint2Comma = 1 -# We have only 1000 api calls per day, so please only do one update per day! -# Or request an own key for free at forecast.io -ApiKey = "137f2d85a1f1db5762e5e073103541d2" - diff --git a/widgets/weather/update_weather.config.sample b/widgets/weather/update_weather.config.sample new file mode 100644 index 00000000..f913d89f --- /dev/null +++ b/widgets/weather/update_weather.config.sample @@ -0,0 +1,23 @@ +[main] + +; use GetLatLangFromCity.php to get latitude/langitude +Latitude = 52.5200066 +Longitude = 13.404954 + +; location shown in Skin +LocationSkin = "Berlin" + +; Can be set to 'us', 'si', 'ca', 'uk' or 'auto' (see forecast.io API); default is auto +Units = "si" +DegreeSign = "°C" + +; Can be set to 'en', 'de', 'pl', 'es', 'fr', 'it', 'tet' or 'x-pig-latin' (see forecast.io API); default is 'en' +Lang = "de" + +; convert . to , for german format +ConvertPoint2Comma = 1 + +; We have only 1000 api calls per day, so please only do one update per day! +; Or request an own key for free at forecast.io +ApiKey = "137f2d85a1f1db5762e5e073103541d2" + diff --git a/widgets/weather/update_weather.php b/widgets/weather/update_weather.php index a35e89f4..4b4dbb86 100644 --- a/widgets/weather/update_weather.php +++ b/widgets/weather/update_weather.php @@ -71,9 +71,9 @@ foreach($conditions_week as $conditions) { continue; } // we only have min & max so we must calc + $temp = round($conditions->getMaxTemperature(), 1); if( $convertPoint == 1 ) $temp = str_replace(".", ",", $temp); - $temp = round($conditions->getMaxTemperature(), 1); fwrite($handle, $temp); fwrite($handle, $degree_sign); fclose($handle); -- cgit v1.2.3