Beemergencies on my toolbar

I have been installing and configuring Linux recently, and I’ve got an idea: what if I displayed my beemergencies in my toolbar? When I’m on my laptop, I sometimes forget about Beeminder until the last minute, where I finally do my urgent Beeminder tasks.

How does it look?

As you can see here, I have one beemergency for today!

How did I do it?

I created a little script that counts my amount of beemergencies

#!/bin/bash

AUTH_TOKEN="XXXXXXXXXXXXXX"
USERNAME="sheik"

goals=$(curl -s "https://www.beeminder.com/api/v1/users/$USERNAME/goals.json?auth_token=$AUTH_TOKEN")

beemergencies_count=$(echo $goals | jq '[.[] | select(.safebuf == 0)] | length')

echo "$beemergencies_count"

Then, I created a Waybar component:

The JSON:

{
    // ...
    "custom/beemergencies": {
        "exec": "$HOME/.config/waybar/beemergencies.sh",
        "interval": 120,
        "tooltip": false,
        "format": "{} 🐝"
    },
   // ...
}

The CSS:

#custom-beemergencies {
    background-color: #FFCB06;
    padding-right: 10px;
    padding-left: 10px;
    color: black
}
4 Likes

I think this is very cool. Anything that makes something less out of sight out of mind.

Could you do this on a windows machine?

1 Like

Thanks!

This software (waybar) doesn’t work on Windows, it only works on Linux.

I don’t have a Windows machine for testing, and I have very little use for it anyway, so I can’t help with it.
I asked Claude and it suggests creating a Python script for it. Not sure what’s the right way to do it on Windows, honestly…
https://claude.ai/share/2644f1fe-e1af-4816-9a9a-998df4562752

Perhaps something a bit more universal that solves the same problem would be browser notifications that shows upcoming Beeminder deadlines – just an idea.

That’s very neat! I recently moved to Hyprland, so am happy to add this in a prime spot to the Waybar :slight_smile:

1 Like

Nice! Wait, let me send you my updated script, because it sometimes flickers a little:

#!/bin/bash

AUTH_TOKEN="AUTH_TOKEN"
USERNAME="USERNAME"
CACHE_FILE="/tmp/beemergencies_cache"

if [ -f "$CACHE_FILE" ]; then
    cat "$CACHE_FILE"
else
    echo "0"
fi

{
    goals=$(curl -s "https://www.beeminder.com/api/v1/users/$USERNAME/goals.json?auth_token=$AUTH_TOKEN")
    beemergencies_count=$(echo $goals | jq '[.[] | select(.safebuf == 0)] | length')
    echo "$beemergencies_count" > "$CACHE_FILE"
} &

I found that sometimes it disappeared while doing the API request, so I made added a “cache file” that stores the last value (and the fetching is done in the background)
(sorry that’s confusing, haha)