Page 1 of 1

Speedtest-CLI as a Desklet?

Posted: Mon Apr 29, 2019 11:48 am
by Kendoori
I am having issues with my ISP regarding consistency of upload/download. I discovered in my hopes of finding a test that wouldn't involve my browser. Works well, but would like a way to park this on my Cinnamon desktop somehow without having to call up a terminal. Ideally I could have a one-click refresh to show results as a Desklet or similar.

Any suggestions?

Re: Speedtest-CLI as a Desklet?

Posted: Mon Apr 29, 2019 4:09 pm
by secureIT
Not a Desklet, but a script which you can run with a launcher.
You must install zenity to interact and to see the results.
May be it is outdated regarding the given testfiles, but you can insert your own testfiles into the zenity dialog .... or modify the script with own testfile-links :

Code: Select all

# Output via zenity in kbit/s 
# Maximum download rate: 1023MB/s
# Selection of the test file -  Choice between given 3 x 10 MB test files
# or enter the url of your own testfile
url=$(zenity --list --text "choose your test file" --radiolist --column "klick" --column "Testfiles 10 MB" TRUE "own" FALSE "" FALSE "" FALSE ""); echo $url
# Own entry of a test file that is not in the selection
if [ $url = "own" ]; then
url=$(zenity --entry --text "please enter your own test file" --entry-text ""); echo $url
echo $url
# Query whether the input field remains empty - otherwise automatic loading of
if [ -z $url ]; then
# The test file is loaded into the virtual recycle bin
# The output from wget is stored for review in /home/speedtester.txt
#  If the script is running and everything is checked, we'll put it up
( wget -O /dev/null "${url}" &> speedtester.txt; echo "Finished!" ) | zenity --progress --pulsate --auto-kill --auto-close
# Extract the speed information from speedtester.txt 
val=$(tail -n2 speedtester.txt |grep -oE "\(.*\)"|tr -d "()" |cut -d " " -f 1 |tr "," ".")
unit=$(tail -n2 speedtester.txt |grep -oE "\(.*\)"|tr -d "()" |cut -d " " -f 2|tr -d "/s")
# After a final check of the script, the following command can be issued
# Subsequent command deletes the textfile speedtexter.txt
# rm /tmp/speedtester.txt
# Check the speed specification from speedtester.txt to MegaByte, KiloByte or Byte 
if [ $unit == "MB" ]; then
tmp=$(echo ${val}| awk '{print $1*1024}')
elif [ $unit == "KB" ]; then
elif [ $unit == "B" ]; then
tmp=$(echo ${val}| awk '{print $1/1024}')
result=$(echo ${tmp} | awk '{print $1*8 }')
echo $result
# Check if a testfile could be loaded
if [ $result == "0" ]; then
zenity --info --text="Testfile could not be loaded "
echo $result
zenity --info --text="Your download speed is      ${result} kbit/s"