With a certain theme we do quite some reshuffling in diazo where I'd like to know if a control panel page is rendered. This can be the overview-controlpanel or any sub controlpanel. Unfortunately there's not a consistent naming standard for controlpanel views afaik, not in plone 4 until Plone 5.1rc1. Nany are called @@something-controlpanel, but there's also a few something-settings', prefs_install_products_form, dexterity-types usergroup-userprefs, portal_registry and those are just the official ones, not add'ons.
What I've done so far is checking for '-controlpanel' on the body class and patching the LayoutPolicy in plone.app.layout to add -controlpanel if there's something that looks like prefs_ or -settings:
extra_controlpanels = ('prefs_', '-settings', 'portal_registry', 'dexterity-types') if any(cls in body_class for cls in extra_controlpanels): body_class += ' -controlpanel'
This has some extra risk on false positives, or a content editor who creates a folder that ends up in section-something.
Another option could be to figure out if a ControlPanelForm from plone.app.controlpanel is used, but how do I check that in the LayoutPolicy, is there something on the request I could check? Or is there something very obvious I'm missing here that I could use?
If we are going to break some compatibilty again in the next major version this is something simple we could put on the todo-list, rename at least every provided controlpanel to something-controlpanel and make that a preferred/required name for add'on controlpanels...