RFC: Overall Implementation Framework of Plugin System #3953
Replies: 7 comments 5 replies
-
|
I think it is safer to separate user configurable settings from the plugin yaml definition. This way we prevent manipulation of plugin stuff by the end user. |
Beta Was this translation helpful? Give feedback.
-
|
If this is primarily about export to Imgur or OCR, I wonder if it makes sense to add a "Share (files/images/content)" portal to xdg-desktop-portals and use that in the long run. Then Flameshot could do without internet access entirely, and as an added bonus all other programs can use the same upload functionality too (or whatever the image gets shared with). KDE has a Frameworks library called Purpose with the same goal of sharing data through plugins. This could be used to implement a portal on the KDE side, or if you don't like the portals concept, could be used by Flameshot directly. |
Beta Was this translation helpful? Give feedback.
-
|
I've been working on an XBackBone upload plugin stub (reference: https://forgejo.wanderingmonster.dev/WanderingMonster/flameshot-post-capture-command/src/branch/main/plugins/xbackbone) which has given me a concrete perspective on what final_action plugins need from the core API. Posting these as requirements from a real-world use case, since the RFC currently specifies the plugin structure well but leaves the core API surface for final_action plugins largely unspecified. What a final_action upload plugin needs from core
Direct access to QGuiApplication::clipboard() via the core API surface, or This cannot be handled by the plugin independently without Qt access, and it is the single most common thing upload plugins need to do.
Expose QNetworkAccessManager or a wrapper for async HTTP, or Without clarity here, every plugin author will independently discover the blocking problem. Config UI gap borgmanJeremy's sketch from #3661 shows plugin icons in the toolbar but doesn't address configuration. Even a minimal convention, "if a plugin exposes a settings() function, Flameshot opens a generated form from metadata_fields", would go a long way. The metadata schema in the RFC already has the metadata_fields structure; it just needs a corresponding UI. AI-forward note |
Beta Was this translation helpful? Give feedback.
-
|
A few design concerns raised in good faith, before these decisions get locked in by implementation:
typedef struct FlameshotContext FlameshotContext; /* Core API the plugin can call / /* Entry points every plugin must export / FlameshotPlugin* flameshot_plugin_create(void); #ifdef __cplusplus
None of these are blockers for getting started. Items 3 and 4 in particular are low-effort to fix before shipping. Items 1 and 2 are worth a short discussion before the C++ class API gets too entrenched to change cheaply. |
Beta Was this translation helpful? Give feedback.
-
|
A concrete reference implementation of this C ABI proposal (header, |
Beta Was this translation helpful? Give feedback.
-
|
@OrcVole I have forwarded your comment on this page to the project maintainers. @mmahmoudian You can also join our matrix channel if you'd like. |
Beta Was this translation helpful? Give feedback.
-
On dbus: I work with Wayland compositor IPC daily on
[wayland-spectre](https://github.com/WanderingM0nster/wayland-spectre)
(KWin, xdg-desktop-portal, PipeWire), and the pattern that holds up is:
dbus is reliable when you're talking to a service that is guaranteed to be
on the session bus already. It gets fragile as a general rendezvous
mechanism when the other end's presence isn't guaranteed, which is the
typical situation for a plugin that may or may not be running at capture
time.
For the subprocess model, my gut tells me keep stdin/stdout as the
primary IPC channel and treat dbus as an optional enhancement for plugins
that explicitly run as persistent session services. That keeps the baseline
portable and avoids requiring plugin authors to reason about bus activation
and name ownership.
The removed grim adapter is useful prior art here. Was it session-bus
based? Was the removal driven by reliability issues, scope, or something
else? Understanding what broke last time would directly inform where dbus
is safe to include and where it isn't.
Subprocess model and `plugins.yaml` as the discovery layer both still look
right to me as the foundation. It is good to hear those are aligned with where
the project is heading.
Thanks for the Matrix invitation. We would be happy to join at some point. What is the
link? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Note: This is a replacement for RFC #2529
**### RFC: Flameshot Plugin System Architecture
Status: Draft • Date: 2025-05-22 • Version: 0.1
1. Introduction
Flameshot requires a scalable plugin framework to enable modular extensions, empower user customization, and future-proof the application against evolving requirements. This RFC outlines the architectural design for a plugin system that balances flexibility, security, and performance.
2. Directory Structure
Plugins are organized under the user's configuration directory with a standardized naming convention:
3. Plugin Configuration Model
3.1 Self-Managed Settings
Plugins have full autonomy over their internal configuration storage (e.g., INI files, JSON, databases). The core framework only mandates system-level metadata in
metadata.yaml.3.2 Standardized Metadata
4. Process-Driven Execution Model
4.1 Configurable Workflows
Users can define custom processing pipelines for action/final_action plugins (e.g., upload, OCR). Pipelines specify:
4.2 Key Principles
QPixmap) and metadata (e.g., file format).5. Interoperability Architecture
5.1 Bidirectional Communication
A layered model enables secure interaction between plugins and the core:
graph LR A[Plugin A] -->|Request| B(Core API) B -->|Response| A C[Plugin B] -->|Request| B B -->|Response| C B -->|Event Trigger| D{Event Bus} D -->|Broadcast| A D -->|Broadcast| C5.2 Core Components
6. Security & Compatibility
7. Core API
7.1 Plugin API
8. References
Change Log:
Beta Was this translation helpful? Give feedback.
All reactions