pop-os / launcher

Modular IPC-based desktop launcher service
Mozilla Public License 2.0
220 stars 42 forks source link

Example Hello-World Plugin Project #73

Open justanotherariel opened 2 years ago

justanotherariel commented 2 years ago

The Problem

I would be interested in making a few plugins for the Pop-Launcher. Sadly, there is not that much information available, especially if you are not familiar with the Rust programming language. I know you can build one in any programming language and the interface is documented (somewhat). I also know there are built-in plugins I can take for reference, but that doesn't help me if I can't figure out how the IPC launcher works. I don't know the build process and I don't know how I can see my plugin working.

Are the built-in plugins already in the launcher binary? Because in the makefile, it seems the launcher binary is just linked to each plugin directory. Does that mean the launcher gets instantiated multiple times? If not, how does this help with the recoverability and isolation of the plugins?

Is there an easy way to make a new plugin in Rust? If I make a new cargo project, it will create another src folder and I will have to extract the binary each time out of it into the correct directory. I didn't plan on making a (more) complicated makefile just because I wanted to program a simple plugin.

Solution

I find the pop launcher incredible and see great potential. I just want to be able to customize it and make it better suit my needs. I think it would be really helpful to the community if an example Hello-World project could be published as a template for other plugins. This could include a folder structure with a makefile or preferably a VSC devcontainer (with easy commands to build the project). Maybe start with Rust and proceed with a few different programming languages such as Python and JavaScript. I could see many people making custom plugins, but this launcher's learning curve is too high. A simple Getting-Started guide and a template would go a long way.

Cheers, Ariel

mmstick commented 2 years ago

The existing plugins are completely separate libraries that use the documented JSON IPC. They're completely separate processes from the launcher service. They're just sharing the same binary file. The only requirement is an ability to send and receive new line separated JSON.

oknozor commented 2 years ago

@justanotherariel we have just added a helper trait to ease plugin development, there is also an example plugin.

I am writing a blog post tutorial about this, I'll keep you updated if your are still interested.

justanotherariel commented 2 years ago

Nice! Love it. Please keep me updated. In the meantime, I used the bangs! plugin (from @foo-dogsquared) as a template and modified it accordingly.

rcastill commented 2 years ago

Hi,

@justanotherariel I just released a plugin written in Rust to add firefox tabs to the launcher

https://github.com/rcastill/pop-launcher-firefox-tabs

Take a look if you want, I'd love some feedback!

lucas-dclrcq commented 2 years ago

While pop launcher maintainers workout an official way to promote/share community plugins we try to maintain a list of all useful plugin here : https://github.com/lucas-dclrcq/awesome-pop-launcher

You can get inspiration there on how to develop a plugin, the ones developed with python are often simpler than with Rust ^^

For example on I did to control the screen's brightness : https://github.com/lucas-dclrcq/pop-launcher-brightness-plugin