Guidelines to create plugins/extensions/addons?

Hello.
I want to know if there are any guidelines like HIG, tips to create addons or extensions or plugins for our applications. If there are none, please give me some tips or recommends based on your experience (as a dev and user).

HIG: https://developer.gnome.org/hig/stable/

1 Like

Libpeas is the standard library for implementing plugins for GLib applications. This is what GEdit, Geary and a number of other apps use.

It as a UI library as well for managing them, but the UI itself is a bit out of date and could use updating to current HIG recommendations for using GtkListBox, etc. I’d still recommend using the Libpeas UI library however since when that does get updated, your application will automatically get the update UI.

1 Like

Yea, I know link of HIG website, that’s not what I asked :sweat_smile:

That’s awesome! Do we have tutorial on how to use it?

HIG (Human interface guidelines) refers to the “user experience” of applications. This covers things like workflow (like a first-start wizard), presentation (margins, spacing), writing style (clear use of language) and so on.

I think you’re using this term to refer to Programming Guidelines, but there is no such document for libpeas or general plugin system design in GObject I’m aware of. Since most of your question are related to Python, I’m not sure how well libpeas is suited for that since it’s usually used by C or Vala applications to allow plugins to be written in C, Vala, Python or Lua.

If you’re already using Python and don’t need support for C plugins or other language, you might be better off just making a simple interface, like a base class with a few overridable functions like enable(), disable() and activate(). This is basically how GNOME Shell extensions function.

1 Like

This is what I’m doing already, so I think, I will just go with what I have. :slight_smile:

Make sure you have a set of interfaces in your program you need your plugins requires to implement in order to increase functionality. The better I saw API with extensions is GEdit, you’ll find a clean API and can be a good guide on how to create your own.

Make sure you design with plugins in mind. You application should use interface objects, implemented by default in your code, but using just the interface API, so your plugins will be used transparently.

2 Likes