Plugins

eboxy can be extended with external plugins, allowing anyone with the inclination and a moderate knowledge of C programming to add functionality to eboxy. Plugins are special shared libraries (.so files in Linux) which you can direct eboxy to load in your skin file.

Usage

Plugins are loaded by either using the loadplugin script command or alternatively by putting a <plugin> element into the XML file. The latter is the recommended method, because it is simpler and allows you to attach event scripts to objects that the plugin registers. Here's a simple example of loading a plugin using a <plugin> element:

...
<page ...>
	<plugin module="myplugin"/>
	...
</page>
...

eboxy will look for plugins in LIBDIR/eboxy only (where LIBDIR is picked up at compile time, usually /usr/local/lib). Also, the .so extension is always omitted. So in the above example, when the page is loaded eboxy will attempt to load the plugin file /usr/local/lib/eboxy/myplugin.so into memory. What happens after that is up to the plugin developer.

When you put the <plugin> element inside a page, the plugin is only loaded while that page is visible. If you want the plugin to be loaded all of the time, put the <plugin> element into the <system> section of the XML file.

Capabilities

Basically, plugins can manipulate on-screen widgets, and create objects that you can access in scripts. For example, you could make a music player plugin that exposes a "musicplayer" object. The plugin could be used like this:

musicplayer.file = "test.mp3"
musicplayer.play

It is possible for plugins to fire events on objects they create. To respond to these events, you add an event into the loading element for the plugin, for example:

...
  <plugin module="myplugin">
    <pluginobject name="anobject">
      <event type="OnSomething">
        echo "Something happened"
      </event>
      <event type="OnSomethingElse">
        echo "Something else happened"
      </event>
    </pluginobject>
  </plugin>
...

The events and objects associated with plugins are defined entirely by the plugins themselves. Check the documentation for the plugin for further information.

Plugins can even go as far as automating a page entirely for you. All you need to do is to set up the page visually for the plugin to work with, using names for the widgets that the plugin expects to find. This means you can change the visual interface independently of how it operates.

More technical details of how eboxy plugins work are described in the eboxy Extension guide. There are two plugins included with eboxy: simplemusic, which enables you to play music files (MP3, OGG, MOD, MIDI, etc.) in much the same way as proposed above; and filebrowser, which works in conjunction with a listbox widget to provide a file browsing interface. Have a look in plugins/simplemusic and plugins/filebrowser.