0

There is no direct API (as far as I can see) but some applications seem to have it.

Although Apple's own icons (e.g. fast user switching, keyboard layout switching) do not have it.

guruz
  • 1,604
  • 14
  • 21

1 Answers1

0

Since OS X 10.10, NSStatusItem has button property, which is a regular NSView-based control that conforms to NSAccessibility protocol and which allows to change accessibilityTitle property directly.

On earlier versions of OS X, you can implement a custom button that looks and behaves exactly like vanilla NSStatusItem and assign it to the item via -[NSStatusItem setView:] method, then use -[NSView accessibilitySetOverrideValue:... forAttribute:NSAccessibilityTitleAttribute] on your custom control to provide a voiceover title.

hamstergene
  • 24,039
  • 5
  • 57
  • 72
  • Hm are you sure about this? It still says "Menu, 10 items", whatever I seem to try (doing thins on the NSMenu, doing it to the button property, ...) – guruz Mar 03 '16 at 14:47
  • I haven't tried it, but this is the only mechanism that controls it. What if you don't set the item's menu, but display it manually in action handler, using `popUpStatusItemMenu:`? – hamstergene Mar 03 '16 at 18:17
  • I still can't get it to work (I'm modifying Qt's qcocoasystemtrayicon.mm) for the non-10.10 solution but I guess you are right with your statements as I've seen the accessibilityTitle in several solutions on github. https://github.com/halo/Brick/blob/44ea46e2f1ff62263e76fc414c1f59f109fcfd0f/Brick/Classes/BrickController.m#L175 https://github.com/gfiumara/stillhere/blob/fa6df178f4ff4e03ecc852959bf795bb6a975ff2/Still%20Here/AppDelegate.m#L96 – guruz Mar 04 '16 at 12:14
  • Tooltip is read before this title. Is there any way to set order. – Durgaprasad May 24 '18 at 08:19