Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
core-code opened this issue Jun 12, 2024 · 1 comment
Open
Labels
Feature New feature or request Triggers Related to the upcoming menu bar triggers feature

Comments

@core-code
Copy link

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

@core-code core-code added the Feature New feature or request label Jun 12, 2024
@jordanbaird
Copy link
Owner

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)

@jordanbaird jordanbaird changed the title [Feature Request]: automatically hide or show items based on whether they have something important to display [Feature Request]: Custom trigger API for applications to implement Jun 12, 2024
@jordanbaird jordanbaird added the Triggers Related to the upcoming menu bar triggers feature label Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request Triggers Related to the upcoming menu bar triggers feature
Projects
None yet
Development

No branches or pull requests

2 participants