programming (and other) musings

Posts tagged "macos":

02 Oct 2025

application badges at your command line

I've been playing with macOS lately, and needed a quick way of grabbing the number of unread articles in NetNewsWire. So I wondered if I could somehow access its application badge label.

The tip

Turns out one can:

lsappinfo info -app NetNewsWire -only StatusLabel

which produces something like:

"StatusLabel"={ "label"="6" }

One day I'll learn awk and feel ashamed of what I'm about to write below, but here's how to use grep to get just that count, if you must:

lsappinfo info -app NetNewsWire -only StatusLabel | grep -E '[0-9]+' -o

and we get only the digits in the output:

6

Hat tip to Alexander's answer to this question, which put me on the right track despite his reservations. Reading the convoluted code in the other answers, I have none at all.

more ...