iterm2 badges: know what a terminal's for at a glance

As someone with ADHD, I’m always looking for things to give me an edge over my own brain.

I try to have no more than three terminal windows (panes do not count). open at a time, because past that point, it becomes difficult to tell them apart quickly. Tab titles certainly help, but I wanted something bigger and more expedient; especially for situations where I might feel anxious or pressured.

iTerm2’s badge feature fixes this: a big, semi-transparent label stamped in the corner of the session, driven by a template you set once in Profile > General > Badge:

\(user.badge)

That pulls from a user-defined session variable, which starts out empty. Set it from the shell. I use rem for remark:

rem () {
  export it2_badge="$1"
  iterm2_set_user_var badge "$it2_badge"
}

(Note that this requires iTerm2 shell integration, since iterm2_set_user_var comes from there)

Then at the start of whatever you’re about to do:

rem THING-005

or just

rem "current fire"

and that terminal now visibly announces its purpose without my needing to read a single line of history.

It also works in panes, if I want that level of granularity for a task. It also helps during cleanup; glance across a wall of panes, see the ticket number or the short label, and know instantly what I can close and which ones I still need. Keeping this information in the terminal keeps it out of my head, which is the whole point of it. :)