macosaccessibilityappkituiaccessibility

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


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:

Does such an API exist?

mockup


Solution

  • 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.