wulkano / Kap

An open-source screen recorder built with web technology
https://getkap.co
MIT License
18.06k stars 825 forks source link

Completely custom plugin config #938

Open karaggeorge opened 4 years ago

karaggeorge commented 4 years ago

Problem I'm trying to solve:

I'd like to create a plugin, which allows you to change your cursor for the recording. For customization, I'd like to allow the user to open an image, and then size it and also point where the center would be (meaning that in a regular pointer cursor it would be top-left, but if you did like a touch one it'd be the center). I'm thinking of a small window that has a preview panel in which you can configure the picture you loaded.

Solutions I'm thinking:

In any case, it's a bit too complex to do with the given json schema. I'm thinking it'd be much easier to provide a hook, so when the gear icon is clicked it just opens my custom BrowserWindow. Alternatively, it could be a custom json schema type, so it has the main settings and then a "More settings" or "Customize" button that opens the custom window.

The hook would have access to the config object, so we can use it to get/set values, this would just be a presentation thing.

This could be used in other plugins as well, for example for kap-camera it could allow picking a camera and seeing a preview

I think another proposed solution we had was exporting a react component to render in the config window, but that'd mean we'd have to be limited to the config window size.

sindresorhus commented 4 years ago

Alternatively, it could be a custom json schema type, so it has the main settings and then a "More settings" or "Customize" button that opens the custom window.

I would prefer this.

I think another proposed solution we had was exporting a react component to render in the config window, but that'd mean we'd have to be limited to the config window size.

I think we could solve this. Would be nice if users didn't have to deal with Electron windows. We could use the useContentSize option and detect document content size changes and then use .setContentSize() or something.