Odin Dutton



AnyBar Internet Status

by Odin Dutton

AnyBar is a small indicator for your menubar that does one simple thing: it displays color dot. What color means is up to you. When to change color is also up to you.

Knowing when your internet drops out before you open your browser and work it out for yourself can be very handy.

When I first heard about AnyBar that was the first use case I thought of.
I wrote a simple script using host to check if my computer can access Google to keep an eye on my connection status.

Put the following script somewhere on your machine an chmod +x it.


quit() {
  echo -n question | $ANYBAR

trap quit EXIT

ANYBAR="nc -4u -w0 localhost 1738"

while true; do
  if ping -c 5 -t 5 -o &> /dev/null; then
    echo -n black | $ANYBAR
    sleep 5
    echo -n red | $ANYBAR

I decided to keep it running in the background using launchd (tutorial).

Replace $USER with your username and put it in ~/Library/LaunchAgents/:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

Launch anybar-internet:

launchctl load ~/Library/LaunchAgents/com.twe4ked.anybar-internet.plist

Stuck? Try me on Twitter: @twe4ked.