I am trying to make a conky net bandwidth speed widget.
Here is the conky:
Code: Select all
conky.config = {
-- — Conky settings
background = false,
total_run_times = 1,
no_buffers = true,
-- — Window specifications with Background
own_window = true,
own_window_type = dock,
own_window_hints = 'skip_taskbar,skip_pager,undecorated,above',
own_window_transparent = false,
own_window_argb_visual = true,
own_window_argb_value = 0,
own_window_colour = '000000',
double_buffer = true,
minimum_width = 300, minimum_height = 263,
alignment = 'middle_middle',
gap_x = 20,
gap_y = 20,
};
conky.text = [[
${execp ./speed.sh}
]];
Code: Select all
#!/bin/bash
# Define your functions
function first_function {
echo "First function is running..."
if command -v speedtest-cli >/dev/null 2>&1; then
speedtest-cli > ~/Desktop/speed.tmp
if [ $? -eq 0 ]; then
echo "Speedtest completed successfully and file created."
else
echo "Speedtest failed to run."
fi
else
echo "speedtest-cli is not installed or not in PATH."
exit 1
fi
echo "First function is done."
}
function second_function {
echo "Second function is running..."
if [ -f ~/Desktop/speed.tmp ]; then
down=$(cat ~/Desktop/speed.tmp | grep "Download:" | awk '{print $2}')
echo "Download speed extracted: $down"
else
echo "Speedtest result file not found."
exit 1
fi
echo "Second function is done."
}
function third_function {
echo "Third function is running..."
echo "\${goto 35}\${voffset 15}\${color red}Download Spd: $down"
echo "Third function is done."
}
function fourth_function {
echo "Fourth function is running..."
mpg123 /home/logansfury/Music/effects/ta-daa.mp3
echo "Fourth function is done."
}
# Call your functions in sequence
first_function
second_function
third_function
fourth_function
Can anyone help fix please?
Thank you for reading,
Logan