Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there an alternative to call_plugin()? #1811

Closed
dkondor opened this issue Jun 17, 2023 · 5 comments · Fixed by #1864
Closed

Is there an alternative to call_plugin()? #1811

dkondor opened this issue Jun 17, 2023 · 5 comments · Fixed by #1864
Milestone

Comments

@dkondor
Copy link
Contributor

dkondor commented Jun 17, 2023

output_t::call_plugin() was removed in #1674 (as plugins are not created for each output anymore). Is there a replacement for its functionality? I would like to be able to programmatically activate other plugins (as if the user pressed the associated keybinding), and this was a very convenient feature, since it only required the name of the action (e.g. "scale/toggle").
Thanks!

@ammen99
Copy link
Member

ammen99 commented Jun 17, 2023

The idea was to enable calling plugins via IPC, replacing the call_method in this way. It would also allow additional parameters to be passed. I have yet to decide on a good API, I think it would make sense to have this ready before 0.8.

@ammen99 ammen99 added this to the 0.8 milestone Jun 17, 2023
@ammen99
Copy link
Member

ammen99 commented Jun 17, 2023

Forgot to mention: IPC methods can of course be also called from other plugins, and for many plugins we'd want a simple wrapper which combines a regular binding + ipc call.

@dkondor
Copy link
Contributor Author

dkondor commented Jun 18, 2023

Thank you, this makes sense!

@ammen99
Copy link
Member

ammen99 commented Jul 4, 2023

#1821 contains a first version of the helper I was speaking of, ipc_activator_t. We will need to gradually replace plain old activators with the new ipc_activator, feel free to send PRs for plugins you want to see updated ;)

@ammen99 ammen99 mentioned this issue Aug 24, 2023
6 tasks
ammen99 added a commit that referenced this issue Aug 27, 2023
By using the ipc-activator helper, scale can now be triggered from an
IPC call, including one generated from another plugin.

Fixes #1811
@ammen99
Copy link
Member

ammen99 commented Aug 27, 2023

In #1864 I have added support for these ipc-activators to the scale plugin since that's what you mentioned here. Other plugins can be handled similarly, PRs welcome.

Here's an example of how to call scale (haven't tested but should work):

nlohmann::json data;
data["output_id"] = output->get_id();

shared_data::ref_ptr_t<ipc::method_repository_t> repo;
repo->call_method("scale/toggle", data);

ammen99 added a commit that referenced this issue Aug 27, 2023
By using the ipc-activator helper, scale can now be triggered from an
IPC call, including one generated from another plugin.

Fixes #1811
ammen99 added a commit that referenced this issue Aug 27, 2023
By using the ipc-activator helper, scale can now be triggered from an
IPC call, including one generated from another plugin.

Fixes #1811
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants