jordanbaird / Ice

Powerful menu bar manager for macOS

Home Page:https://icemenubar.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request]: Custom trigger API for applications to implement

core-code opened this issue · comments

Description

are there any plans of supporting Bartender's "API" that apps like ours have implemented so that the menubar item will only be displayed if there is something important to display?
it boils down to two things:
• setting the accessibility value of the menubar item to the numeric value of "important items". presumably the item is hidden of the accessibility value is empty or '0'
• sending global notifications to let menubar manager apps know when the value changes
here is how we've implemented that API:

if (appsWithUpdatesCount)
_visibilityManager.statusItem.button.accessibilityValue = @(appsWithUpdatesCount).stringValue;
else
_visibilityManager.statusItem.button.accessibilityValue = nil;
[distributedNotificationCenter postNotificationName:@"Bartender.MenuBarItemStateUpdated" object:appBundleIdentifier userInfo:nil];

in our case (MacUpdater) this has resulted in the menubar item being shown when there are updates-to-install but hidden if all apps are up-to-date.

obviously the notification name can/should be changed to something more vendor-neutral

Screenshots

No response

I wasn't aware that Bartender had this, but yes, we should be able to do that. It will, of course, have to wait until triggers are ready to be implemented (#62)