On your Mac

Notifications

Status notifications, the Dock badge, a page's own notify, and the controls on each Mac.

On this page 11 sections

Legato posts a macOS notification when a status, gauge or fleet card moves up to warning or critical. A page can also ask for one of its own with notify: a deploy finished, a backup failed, a price dropped.

Legato posts them itself, on your Mac. Nothing goes through Apple's push service or any server.

Deploys                              Deploys
Production                           Deploy finished
Critical: 502s from api-3            v2.15 is live on all 6 hosts.

  a status change                      a page's notify

A notification has the page's title as its title.

Notifications post while Legato is showing pages: during the trial or with a license. Once every page locks, nothing posts, since a locked page has no cards to follow.

What notifies

What Legato follows

Status notifications follow each card on its own, so a second card moving to critical on a page that already has one still notifies:

CardFollowedLevel
statusthe cardits state
gauge with bandsthe cardthe state of the band its value is in
fleeteach item, by namethe item's state

The levels are ok, warning and critical, and off counts as ok. unknown, and a gauge value outside every band, say nothing either way: the card keeps the last level it had. A card still waiting for its source's first answer doesn't count as a change either. A page that shows Can't read this page has nothing to follow.

Nothing else notifies: not text tones, not a stat going up, not a new row in a list. A page that wants to tell someone something uses notify.

Status changes

FromToNotifies
okwarning or criticalYes, with a sound
warningcriticalYes, with a sound
criticalwarningNo: it still needs attention, and less of it
warning or criticalokOnly for pages set to All Status Changes, without a sound

The notification's subtitle is the card's label, and its body is the level with what the card says: Critical: 502s from api-3 for a status card's detail, Critical: 93.5 % for a gauge's reading and unit, Critical: db-1 · disk full for a fleet item's name and detail. A card with nothing more to say gives just Critical or Warning. A recovery says Back to OK, with a fleet item's name: Back to OK: db-1.

A card's newer status notification replaces its older one in Notification Center, so a card that flaps updates one notification rather than piling up. notify notifications stack. All of a page's notifications are grouped together.

macOS keeps the notifications in Notification Center, with what the card said, until you clear them. When a page has been gone from the Pages folder for five minutes, Legato removes its notifications too.

What doesn't notify

  • A card's first level on this Mac. The first time Legato reads the Pages folder, and whenever a new page, card or fleet item appears after that, it records the level without notifying, even if it's critical.
  • A page whose file was removed and written again: Legato forgot it when it went, so it starts over.
  • A page set to Off, a muted page, a page in a muted collection, and the page the panel has open.
  • The welcome pages that come with Legato.
  • Anything at all while Show notifications is off.

A change that doesn't notify for one of these reasons isn't saved for later.

The notify field

notify asks Legato to show one notification of the page's own. It's an optional top-level field in the page file, written with the rest of the page:

json
{
  "title": "Deploys",
  "icon": "shippingbox",
  "cards": [
    { "id": "prod", "type": "status", "label": "Production", "state": "ok", "detail": "v2.15 since 14:02" }
  ],
  "notify": { "id": "deploy-142", "title": "Deploy finished", "body": "v2.15 is live on all 6 hosts." }
}
Field
idrequired1–64 characters: letters, digits, ., _, : and -, starting with a letter or digit, like deploy-142.
titleoptional1–60 characters. Shown under the page's name.
bodyrequired1–200 characters.

No other keys are allowed. A notify that breaks these rules (a sound key, say, or a body over 200 characters) stops the whole file loading: the page shows Can't read this page, and set_page answers invalid_page.

  • Once per id. Each Mac shows each id once per page. Writing the page again with the same id shows nothing more, so an agent or script that writes on a schedule can leave its last notify in place. To notify again, use a new id. Legato remembers the last 50 ids on each page, and forgets a page's ids when its file is removed.
  • Only the latest file counts. notify is part of the page, not a queue. If the file is written again before Legato reads it, only the newer notify is seen, and the replaced one is never shown.
  • 24 hours. A notify in a file last modified more than 24 hours before Legato sees it is skipped.
  • It stays in the file. get_page returns it with the rest of the page, until a write changes or removes it.

A notify on a page that's new to your Mac does show. Only the pages already there the first time Legato read the Pages folder have their ids recorded without notifying.

notify follows the same per-page setting as status changes: Off silences it, and Needs Attention and All Status Changes both show it. It's shown with a sound.

Each page's setting

Right-click a page in the panel's sidebar and choose Notifications:

SettingNotifies
Needs AttentionA card moving up to warning or critical, and notify. The default.
All Status ChangesThe same, plus a card going back to OK.
OffNothing, notify included.

The setting is stored on this Mac, not in the page file, so writing the page can't change it. The page's Details shows it under Settings, with the time a mute ends.

The Dock badge

Legato's icon in the Dock carries a red badge with the number of pages that need attention now: a status, gauge or fleet card at warning or critical. It updates as cards change and goes away when none do. A page whose notifications are Off isn't counted, and a page with params counts its home item, the one its defaults show. macOS shows the badge only while it allows Legato's notifications; Legato asks the first time it has a notification to post.

Mute for 1 Hour

Every notification about a page has a Mute for 1 Hour action, and the page's right-click menu has the same item. While a page is muted, it doesn't notify, and its right-click menu shows Unmute with the time the mute ends. A mute ends on its own after an hour. It's stored on this Mac, like the page's setting. The menu item is greyed out for a page set to Off.

Muting a collection

Right-click a collection's icon and choose Mute Notifications, and none of its pages notify until you choose Unmute Notifications there. Unlike a page's mute, it doesn't end on its own. It covers the pages its sidebar lists; a detail page follows its own setting. Lights, Details and each page's own setting stay as they are. It's stored on this Mac.

Turning notifications off

Settings → General → Notifications → Show notifications turns every notification off, on this Mac. It's on to begin with. See Settings.

macOS asks whether Legato may send notifications the first time Legato has one to post, not at launch. If you don't allow it, that notification is lost, and so is any later one, until you allow Legato in System Settings → Notifications.

While macOS has Legato's notifications off, Settings → General says so, with an Open System Settings… button. How they look (banners or alerts, sounds, Focus) is up to macOS's settings for Legato.

After launch and wake

For 30 seconds after Legato starts and after your Mac wakes from sleep, no status or notify notification posts while pages catch up. A wake during that time starts the 30 seconds again. At the end, Legato compares each card with where it was when the 30 seconds began. After launch, that's where it was when Legato last ran, so a card that moved to critical while Legato was quit still notifies.

  • A card that's now at a higher level than it was posts a notification. A card that moved up and came back meanwhile posts nothing.
  • Recoveries are dropped, even for pages set to All Status Changes.
  • A notify with a new id that arrived meanwhile is shown, if its file was modified in the last 24 hours.

If only one thing happened, it posts as itself. If several did, Legato posts one summary instead: Legato, then a line like 2 pages need attention, 1 new notification, then the pages' names. A page with several cards at warning or critical counts once.

Rate limits

On each Mac, Legato posts at most 4 notifications per page, and 20 in all, in any 10 minutes. Notifications over either limit are dropped, not delayed. A page whose cards flap between ok and critical every few seconds notifies four times, then not again until the 10 minutes have passed.

Clicking a notification

Clicking a notification opens the panel on its page. Clicking a summary opens the panel. Dismissing one does nothing else.

Buttons on notifications

A status notification about a card also carries that card's buttons (for a fleet, the fleet card's), so you can act on it from the notification. It shows up to three, before Mute for 1 Hour. A button goes on the notification only if it:

  • runs without asking: a "kind": "open" button, or an http button with a success check and no confirm. An http button without a success check is one Legato asks about before pressing it from Shortcuts, and a notification can't ask, so that button stays in the panel. add-event buttons open a form, so they stay in the panel too;
  • is on offer when the notification is posted: its source has answered, its when condition holds, and it isn't already running.

Pressing a button on a notification runs it without opening the panel. If it's no longer on offer, or the service says it failed, Legato posts another notification saying why.

Recoveries, notify notifications and summaries carry no buttons.