Handling of (shift-)cmd-backquote


Richard Kennaway
 

Applications on macOS respond to command-backquote and
shift-command-backquote by bringing one of the application's non-frontmost
windows to the front. I have these questions about how this works:

1. Where can I find a definitive account of which window is brought to
the front? It isn't simply second-front or rearmost respectively, it's
history-dependent. For example, if there are three windows in the order
ABC from front to back, repeated command-backquote gives the succession of
orderings

ABC -> BAC -> CBA -> ACB -> BAC

after which it cycles through the last three of these. The rule seems to
be that cmd-` brings forward the window that is nextmost relative to the
ordering they had at the beginning of the sequence, and sh-cmd-` the
previous relative to the original ordering. But I'd rather find an
authoritative statement than reverse engineer this.

There is also the issue of which operations by the user in between these
keystrokes will reset the "original" ordering to be the current ordering.
For example clicking in any window does, scrolling with the mouse doesn't.

I've searched Google, developer,apple.com, and forums.developer.apple.com,
but haven't turned up anything.

2. Does this functionality come by default for every application, or does
the developer have to do something to obtain it? All applications I've
looked at, except one, do this in the same way, so I expect it's
automatic. In the exception, the developer has presumably programmed their
own handling of these keystrokes.

3. If it is automatic, but the developer wants to do something different
with these keystrokes, how would they override the automatic processing?

-- Richard Kennaway