I had a nice ping indicator applet I was using in Gnome 3 (and it beeped at me when the ping timed out). Is something like this available for MATE?
Thanks!
I had a nice ping indicator applet I was using in Gnome 3 (and it beeped at me when the ping timed out). Is something like this available for MATE?
Thanks!
If you know a little bit of Bash/Shell scripting, you can create your own ping indicator.
The Command applet can execute a custom script at an interval and gives you the power to handle the output however you like. Whether that's the message on the panel or to actually execute the commands as a response to this ping failure.
Here's a quick script that would accomplish the job:
#!/bin/bash
ping 8.8.8.8 -c 1
# Check if ping failed
# 0 = Success
# 1 = Bad ping
# 2 = Unreachable
if [ ! "$?" = "0" ]; then
echo "Ping Error" &>/dev/null
notify-send "Ping Error" "Bad connection to 8.8.8.8" -i error
canberra-gtk-play --id=dialog-error
else
echo "Ping OK"
fi
(Excuse the lack of indenting, it doesn't work on here)
Copy, paste and tweak this into a text editor and save it with the .sh extension. Right-click the file, select Properties and set "Allow executing file as program" under the Permissions tab. Then set up the Command applet to point to this script and set the interval.
It performs the same job as a Ping applet would, but gives you control over how it behaves if a ping fails or succeeds.
man ping
contains more details about the command if you'd like to dive deeper.
For anyone who'd like a run down to study what this does:
ping 8.8.8.8 -c 1
Pings address 8.8.8.8
(Google's DNS) and counts 1 time.
$?
catches the output of the last command.
&>/dev/null
prevents the output of ping
appearing on the panel.
After the if
:
** Displays the message "Ping Error"
on the panel.
** notify-send
sends a notification with a title, description and error icon.
** canberra-gtk-play
plays the dialog-error
sound, can be changed to an other one from /usr/share/sounds
or use --file "/path/to/sound
for a custom sound instead.
** Else, "Ping OK"
appears on the panel when the ping succeeds.