0

I'm working on an accessibility app and I'd like to display a window or panel anchored to the top of the Mac at all times, on top of all other apps. See the attached mockup for a visual. Preferably, I would like this panel to:

  • Appear on all spaces
  • Be unmovable
  • If the user maximizes the window, it doesn't cover up the accessibility panel

Does such an API exist?

mockup

Corey Farwell
  • 1,856
  • 3
  • 14
  • 19
  • I'm asking which of the build-in native Apple APIs to use. I did not ask for any of these: "book, tool, software library, tutorial or other off-site resource" – Corey Farwell Jun 23 '22 at 23:58

1 Answers1

1

Is there a Mac API to display a panel with accessibility options at the top of the Mac at all times?

Yes, use main menu window level and position it at top using setFrame(_ frameRect: NSRect, display flag: Bool)

window.level = .mainMenu

like in NSPanel not hiding when focus is lost, Swift - how to make window unactivable?

Appear on all spaces

Yes, it can be set by collection behavior

window.collectionBehavior = .canJoinAllSpaces

Be unmovable

Yes, hide title bar for window and don't make it movable by background

window.titleVisibility = .hidden

like in https://stackoverflow.com/a/60252103/12299030

If the user maximizes the window, it doesn't cover up the accessibility panel

In general no, you can do this only within your own application just by tracking window frame. Other applications' windows are not under your control.

Asperi
  • 228,894
  • 20
  • 464
  • 690
  • > In general no, you can do this only within your own application just by tracking window frame. Other applications' windows are not under your control. How do other apps like Magnet work where they can rearrange all windows on my Mac? https://apps.apple.com/us/app/magnet/id441258766?mt=12 – Corey Farwell Jun 27 '22 at 18:13
  • Of open APIs only AppleScript comes in mind. Also accessibility (if turned on) - https://stackoverflow.com/a/47489959/12299030. – Asperi Jun 27 '22 at 18:19