cairoshell
cairoshell copied to clipboard
Cairo Extensibility
Does Cairoshell have a module or plugin system? I'd love to develop some "native" apps for it :)
A plugin system for Cairo is on the roadmap but is not yet implemented. Feel free to help out if you'd like!
hmm I'll fork the code and see what I can come up with! At the very least, there needs to be, I think, some type of CairoApp framework. I think that would be awesome!
I know @josuave has thought about ways to implement this in the past so hopefully he has some input. A good starting point would be the ability to host plugins inside the menu bar (a la menu extras on macOS). We would also need a way for the plugin to be able to inherit Cairo themes and common functionality.
I have an idea on how, the issue is modifying the current code to call "plugin xyz" when it needs to, or display different things, etc.
I will see if I can get some code posted in my fork. I was toying with a provider-based plugin system and a WindowsShell-object-model to apply to Cairo. Let me know if you want to discuss further
+1 for this, should be very high priority. I would love to write plugins to display special things in the menu bar for example. I don't enable notification icons so I have a ton of empty space I'd like to make use of.
This is now possible in my fork of cairoshell. I have added a plugin system and a simple object model/extension point for the PlacesMenu
Submit a merge request then!
@josuave Awesome, please submit a pull request when your code is ready!
Will do, gotta figure out how
@josuave - With the forked repo, go into "Pull Request" and select "Create" then answer a couple simple questions :)
@josuave Thanks, I've merged the changes. I hope we can use this foundation throughout Cairo to improve extensibility and use the logging system for the entire app. I did run into one issue, for plugins that modify the UI like the Places menu, we need to find a way to dynamically instantiate the UI objects multiple times, since currently this won't work with multiple monitor support enabled.
This would be best achieved by putting focus on a more robust object model, my next goal! The sample I made could be modified to loop over the screens/menubars and create an entry in all of the “Places” instances
I will also build a couple more plugins to demonstrate how plugin dependencies work.
Sounds good! I did just commit a few tweaks to the build configuration and some other minor items.
@josuave is it possible for plugins to be in a subfolder? Would clean things up and prevent needing to handle some exceptions with non-managed DLLs.
I’ll take a look at this tomorrow.
I am looking into a simpler plugin mechanism. I have been toying with using MEF for plugins and NuGet for distribution/management. This is a cool idea as it provides a possibility for a Cairo Store in the future
I have stopped the exceptions with unmanaged dlls. I can keep the current plugin implementation and use an assembly naming pattern “CairoDesktop.Plugins.*” or I can replace it using MEF. This should be simpler and should solve a lot of the dependency issues while loading assemblies from alternate locations. Let me know what you think and I will keep investigating
Would be cool to combine MEF with nuget.
You don't need to restrict package names -- instead you can specify a tag like cairo-desktop-plugin
in your plugin package.
One tricky thing about the dependencies -- nuget packages are multi-targeting, so you cannot just go grab all the dlls and load them -- you'll end up loading duplicated assemblies for different RID, say linux
or osx
, or different TFM, say netcoreapp
and net47
.
Also, the plugins may have conflicting dependencies. Not to mention that some deps probably have custom build actions that doesn't look like anything in the nuget package itself..
I think the best way to solve these problems is to actually put all the plugins into a C# project, nuget restore and build it, then get the artifacts from the bin
dir -- if everything goes well you should have all the dependencies properly put together in a shallow directory.
btw this is possible because msbuild
is always available where cairoshell runs.
For anyone interested, the relevant context: https://github.com/cairoshell/cairoshell/blob/ec7693eab176d803551d7f92f4ab8538711e7fb3/Cairo%20Desktop/Cairo%20Desktop/Services/PluginService.cs
This is actually something we have discussed internally. ideally cairo would be able to search a repo for available packages. This is a long term goal and not currently on any active to-dos. We are activly undergoing a large refactoring that should make plugin development a bit easier going forward
Cool, thanks for the heads up. When everything stablizes down I'd like to implement a window manager-ish thing.
I have been thinking about long term as well, and was thinking maybe another option would be to deliver it, via a catalogue, manifest, or database. This is linked to a REST API (json response) backend, that will return relevant info, and/or extension plugins.
The backend would enable rating and giving feedback, posting screenshots, providing changelogs for info.
I noticed this issue and some things relating to extensions for the menubar. How exactly does this work? I can't find anything related to actually making an extension for the menubar.
I noticed this issue and some things relating to extensions for the menubar. How exactly does this work? I can't find anything related to actually making an extension for the menubar.
We have an samples repo, here: https://github.com/cairoshell/CairoExtensionSamples
Cairo is in need of many more extension points. Feel free to check everything out, make any suggestions, contributions or ask questions.
I'm currently trying to make a plugin but I can't seem to get it to build.
It just fails with The name 'InitializeComponent' does not exist in the current context
whenever I try to build it.
I've attached the contents of the plugin folder as a zip. Could I get some help on what I'm doing wrong?
@ashifolfi Did you get anywhere with your issue?
no I still haven't figured it out