Overlay development
The Overlay window (Overlay window)is a small window independent of the main interface that you can drag, minimize, and resize. It is usually for tool panels that stay open, such as an AI assistant chat window.1. Declare an Overlay window
Declare bothcontributes.menuItems (the entry point) and contributes.overlay (the Overlay window configuration) in the Manifest (manifest):
menuItems[].actionmust be"overlay"; only then does clicking the sidebar button open the Overlay window instead of navigating to a pageoverlay.file: the path to the Overlay window HTML file (relative inside the.qplugin)overlay.titledefaults tomenuItems[].label
2. Write the Overlay window HTML
overlay.html is a complete HTML document (with its own <html>/<head>/<body>), and its scripts can use the .p-* Component (component)classes and window.__PLUGIN_API__ directly.
Overlay window environment
- The
.p-*Component styles and theme variables are injected automatically, so it follows the light and dark themes window.__PLUGIN_ID__is the current plugin id (available inside the Overlay window)- All
__PLUGIN_API__methods are available (including the streamingproxyFetchStream) - The Overlay window is a Sandbox iframe (
sandbox="allow-scripts"), so its scripts are isolated from the main interface - The title bar (title, minimize, close buttons) is rendered by the Launcher; your HTML only owns the content area
Toggle panels inside an Overlay window
Inside an Overlay window, a.p-swiper switch with data-p-switch shows and hides a panel automatically:
3. Create Overlay windows dynamically
Instead of going through the sidebar, plugin scripts can also create Overlay windows at runtime:overlay.* methods
Permission:
ui:sub_window
4. Package and publish
The Overlay window HTML must ship with the package (overlay.file points to a path inside the package). When you package with the CLI, qomicex pack copies overlay.html from the project root into dist/ automatically:
overlay.file references dist/overlay.html but the source overlay.html sits in the project root, qomicex pack copies it in for you; if you package by hand, copy it yourself (see the packaging section of React + Vite plugin development).
5. Notes
- The Launcher processes the Overlay window HTML: it moves
<style>/<link>into the head, strips the<html>/<head>/<body>shell, and injects Component styles - The Overlay window is draggable (click anywhere that is not a button), and with
resizable: trueyou can resize from the bottom-right corner (minimum 200×120) - Close an Overlay window with the x button in the title bar; inside a plugin, destroy it with
__PLUGIN_API__.call('overlay.destroy', id) - Script errors in an Overlay window do not affect the main interface; check the DevTools console when debugging