Documentation/CurrentDocumentProtocol

"Current document" protocol

Overview

This protocol allows document viewers to register currently open document for the benefit of global menu (other UI elements, such as device lock screen may also use this information).

Protocol

In order to declare current document application should expose the following properties on X window it owns. All properties are optional.

  • ACTIVE_DOC_TITLE - string property with document title
  • ACTIVE_DOC_AUTHOR - string property with author name
  • ACTIVE_DOC_SERIES - string property with series name
  • ACTIVE_DOC_SERIES_NUMBER - integer property with number in series. Should only be set if series name is set.
  • ACTIVE_DOC_COVER_IMAGE - binary array property with book cover image, uncompressed, in PNG, JPEG or GIF format.
  • ACTIVE_DOC_PAGES_COUNT - integer property with amount of pages in current document.
  • ACTIVE_DOC_CURRENT_PAGE - integer property with number of page currently open in document.

Then application should set the following property on X root window:

  • ACTIVE_DOC_WINDOW_ID - XID property containing ID of window with properties declared above

Global menu or any other part of system will activate document by sending ConfigureWindow request with CWStackMode mode and value Above (equivalent to Xlib XRaiseWindow).

Best practices

ACTIVE_DOC_WINDOW_ID property may be overwritten by other application, so it is recommended for application to watch for its changes and shutdown itself when another document becomes active, in order to save memory.