I try to add custom menus to the menus at the top bar in 2.80. The old INFO_HT_HEADER.append() doesn't work any more. I found TOPBAR_HT_upper_bar.append() to kind of do the trick but I get two menus, one after the workspace tabs (would preferably have it before but I guess that is a feature request separate from this) and one after the view layer menu. Am I using the wrong thing or is this a bug? Here's a super simple menu from an example which gives me the problem.
import bpy
class customMenu(bpy.types.Menu):
bl_label = "Custom Menu"
bl_idname = "view3D.custom_menu"
def draw(self, context):
layout = self.layout
layout.operator("mesh.primitive_cube_add")
def draw_item(self, context):
layout = self.layout
layout.menu(customMenu.bl_idname)
bpy.utils.register_class(customMenu)
bpy.types.TOPBAR_HT_upper_bar.append(draw_item)