According to the developer documentation you should create an NSTitlebarAccessoryViewController and then set the layoutAttribute property to:
The default value of this property is
NSLayoutAttributeBottom, which means that the accessory view should display below the title bar. You can also set this property to
NSLayoutAttributeRight or (in apps linked on macOS 10.11 or later)
NSLayoutAttributeLeft. All other values are invalid and will cause an assertion to be raised.
BELOW, LEFT or RIGHT of the title bar but NOT over it. So can you really replace it with a title that can be justified or display special characters? According to the documentation you might be able to set the titleVisibility to windowTitleHidden and then set the layoutAttribute to NSLayoutAttributeRight. Has anyone actually done this?