mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-07 19:59:14 -04:00
bcb5617194
- single plugin can register multiple types - e.g. daemon, bar widget, desktop widget
2.2 KiB
2.2 KiB
Composite Example
A single plugin that provides all three surfaces at once by combining three of the standalone example plugins:
| Surface | Source example | File |
|---|---|---|
daemon |
WallpaperWatcherDaemon | CompositeDaemon.qml |
widget |
Emoji Cycler (bar widget + popout) | CompositeBarWidget.qml |
desktop |
Desktop Clock | CompositeDesktopWidget.qml |
It demonstrates the components manifest map, where each surface points at its own
QML file:
"type": "composite",
"components": {
"daemon": "./CompositeDaemon.qml",
"widget": "./CompositeBarWidget.qml",
"desktop": "./CompositeDesktopWidget.qml"
}
All surfaces share one settings UI (CompositeSettings.qml) and one plugin-settings
namespace (exampleComposite), so pluginData is the same for every surface.
Surfaces
- Daemon — watches
SessionData.wallpaperPathand runs a user-configured script on change. Also registers anIpcHandler(target: "compositeExample") exposing arunHookcall, so you can trigger the hook over IPC. - Bar widget — cycles emojis in the bar; click the pill for an emoji picker popout that copies to the clipboard.
- Desktop widget — an analog/digital clock you can drag and resize on the desktop.
Usage
- Copy this directory into
$CONFIGPATH/DankMaterialShell/plugins/. - Settings → Plugins → Scan for Plugins, then enable Composite Example.
(Composite plugins respect the enable toggle — unlike a pure
desktopplugin they do not auto-load, because they also carry a daemon.) - Add the bar widget via Settings → Appearance → DankBar Layout.
- Place the desktop clock via Settings → Desktop Widgets.
Notes
- The daemon surface is instantiated once and lives for as long as the plugin is enabled. The bar and desktop surfaces are instantiated per bar/placement per screen.
- Cross-surface runtime state (not needed here) is best shared via
PluginService.getGlobalVar/setGlobalVaror the daemon instance, since each surface is a separate object. requires_dmsis>=1.5.0because thecomponentsmulti-surface manifest is only understood by DMS 1.5.0 and later.