DankMaterialShell icon indicating copy to clipboard operation
DankMaterialShell copied to clipboard

PluginService warns on every startup for directories that hold shared QML between plugins

Open Mark2Mac opened this issue 3 months ago • 1 comments

Summary

PluginService tries to load plugin.json from every subdirectory of the plugin directory and logs a warning for each one that has none. A directory holding QML shared between plugins therefore produces a warning on every single startup, with no documented way to avoid it.

Reproduction

~/.config/DankMaterialShell/plugins/
├── _shared/          # QML imported by the plugins below, no plugin.json
│   └── Helper.qml
└── demo/
    ├── plugin.json
    └── Demo.qml      # import "../_shared"

Every launch logs:

WARN qml: [PluginService:211] manifest load failed /home/…/plugins/_shared/plugin.json 2

Tested on dms-shell 1.5.3-1, quickshell 0.3.0-2.1 (Arch/CachyOS).

Why the layout exists

Several small plugins (bar pills) share formatting helpers and a common data source. Duplicating that QML into each plugin is the alternative, and it is worse.

AGENTS.md documents Common/ for the shell's own shared resources, and the plugin section of README.md documents the manifest format, but neither describes how two user plugins should share code. import "../_shared" works — only the scan complains.

Why it is worth fixing

The warning is harmless in isolation. Its cost is that it is permanent: it appears at every startup, in a log people are expected to read when something breaks, and a message that is always there is a message that stops being read.

Suggested fix

In the directory scan, skip entries with no plugin.json instead of attempting the load and warning. That is also the semantically honest reading: a directory without a manifest is not a plugin that failed to load — it is not a plugin.

If a marker is preferred over silence, skipping directories whose name starts with _ would match the convention this layout already assumes.

I am happy to open a PR if you tell me which of the two you would rather have.

Mark2Mac avatar Aug 19 '26 14:08 Mark2Mac

There is a workaround that costs nothing, and it is worth writing down because it also points at the smallest possible fix.

Name the shared directory with a leading dot. Both FolderListModel instances in PluginService.qml (lines 95 and 108 on master) set showDirs, showFiles and showDotAndDotDot, but leave showHidden at its default of false — so a directory whose name begins with . is never enumerated, and never gets a manifest load attempted against it.

Measured on this machine after renaming _comune to .comune and updating the 12 import "../_comune" lines:

"manifest load failed"    9 startups -> 9 warnings   becomes   0
plugins loaded            14 / 14 [loaded]           unchanged
ReferenceError on shared types                       0

QML resolves import "../.comune" without complaint, and the singletons registered through that directory's qmldir keep working.

Two caveats, which are why I do not think this closes the issue:

  1. It depends on an implementation detail. Nothing documents that the plugin scan skips hidden directories; it follows from a FolderListModel default. If showHidden: true were ever set — for a good reason, such as supporting dotted plugin directories — every installation using this workaround would start warning again, with no obvious connection to the change.

  2. Renaming a directory that plugins import from is not free for anyone who deploys plugins by copying rather than syncing: the old directory stays behind, still scanned, still warning, and now shadowing the new one if an import is ever reverted. That has to be cleaned up explicitly.

The smallest fix on your side is probably to treat "no plugin.json in this directory" as not a plugin and move on silently, rather than as a failed load — the current message reports the absence of a file that was never promised. A slightly larger one would be to accept a manifest with "type": "library" (or a components block with no plugin surface), which would let a shared directory declare itself instead of hiding.

Mark2Mac avatar Aug 26 '26 20:08 Mark2Mac