Speedtest-CLI as a Desklet?

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Kendoori
Level 5
Level 5
Posts: 748
Joined: Thu Jul 09, 2009 12:51 pm
Location: Sanibel, FL USA

Speedtest-CLI as a Desklet?

Post by Kendoori »

I am having issues with my ISP regarding consistency of upload/download. I discovered https://github.com/sivel/speedtest-cli 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?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
secureIT
Level 4
Level 4
Posts: 471
Joined: Wed Dec 05, 2018 1:26 pm

Re: Speedtest-CLI as a Desklet?

Post 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

#!/bin/bash
# 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 "http://speedtestx.de/testfiles/data_10mb.test" FALSE "http://speedtest.wdc01.softlayer.com/downloads/test10.zip" FALSE "http://download.thinkbroadband.com/10MB.zip"); 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
fi
echo $url
#
# Query whether the input field remains empty - otherwise automatic loading of
# speedtest.wdc01.softlayer.com/downloads/test10.zip
#
if [ -z $url ]; then
url="http://speedtest.wdc01.softlayer.com/downloads/test10.zip"
fi
# 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
tmp=${val}
elif [ $unit == "B" ]; then
tmp=$(echo ${val}| awk '{print $1/1024}')
fi
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 "
else
echo $result
zenity --info --text="Your download speed is      ${result} kbit/s"
fi
exit
.
Locked

Return to “Compiz, Conky, Docks & Widgets”