This is the home of the shortcut handler binary.
The shortcut handler allows clients to register the keyboard shortcuts they are interested in. If the shortcut manager notices a sequence of keys matching one of the clients' expressed shortcut interests, it notifies the respective client. The client can then execute an action based on the shortcut that was activated.
The clients register through the fuchsia.ui.shortcut2/Registry protocol, by calling Registry.SetView(ViewRef, client_end:Listener), providing its ViewRef and the client end of the fuchsia.ui.shortcut/Listener protocol by which it will receive shortcut notifications. The ViewRef is necessary for the shortcut manager to understand where in the view hierarchy this particular client is, and this information together with the focus chain information is used to determine which view should receive the focus. The client then calls fuchsia.ui.shortcut2/Registry.RegisterShortcut as many times as needed to define individual Shortcuts.
The shortcut manager does not support arbitrary key sequences as key shortcuts. While this choice does not yield the most universal shortcut support, it is adequate for Fuchsia‘s present needs, and will be evolved as Fuchsia’s shortcut supporting needs evolve.
When registering a shortcut key sequence, the Shortcut API requires the developer to pick a unique 32-bit unsigned integer as a shortcut identifier. This identifier will be sent back via fuchsia.ui.shortcut2/Listener.OnShortcut when the key sequence is recognized. At the moment there is no facility to modify the shortcuts once defined. If clients come about that do require more involved shortcut processing, the shortcut API will need to be evolved too to meet that request.
The shortcut handler itself reacts to two kinds of notifications:
It is notified of keyboard events, through fuchsia.ui.shortcut/Manager.HandleKey3Event. Typically it is the input pipeline that calls into this protocol.
It is notified of the change of focus through fuchsia.ui.shortcut/Manager.HandleFocusChange. This is also typically done by the input pipeline, although at the time of this writing there also exists an unexpected detour via the Ermine shell which should be removed.