Dev



Introduction

Integrating Snarl into your application is incredibly easy and could be as simple as including an extra header file, referencing a COM object or sending a few TCP/IP packets - in fact, there's probably already a library for the programming language you're using.

Applications talk to Snarl by sending it a command with a series of arguments.  Here's an example command: 
notify?app-sig=some/app&title=Hello, world!&text=This is a notification 
How this command is actually sent to Snarl depends on the transport medium you want to use.  Presently, there are two such mediums:
As well as these methods, Snarl also supports:

Adding Snarl support to your application

The easiest way to add Snarl support is to use the Snarl Framework (coming soon).  This handles sending notifications to Snarl running on the local computer and to a remote computer seamlessly and also provides a built-in notification that's displayed if Snarl isn't installed (or running) on the computer.
 
Once you've selected the appropriate library, read the Snarl Integration Guide for more details on how to incorporate Snarl support in your application.  Alternatively, if you fancy a more low-level approach, you might want to try one of the following:

Win32 Modules and Libraries

Snarl Network Protocol (SNP) Libraries

Creating Your Own Library

If you can't find a suitable library you can always roll your own - you'll find complete documentation on how to do this here.

Creating Custom Styles and Extensions

Styles

Styles provide a means of getting notification content to a user, be it visually via a style which displays the notification on-screen, one which speaks the notification content, or one that sends the content to another device or computer.
 
Snarl supports two primary style types:
  • Display - these create content which Snarl can then display on-screen in a managed way;
  • Redirect - these process the content in an unmanaged way; that is, redirects do not generate content for Snarl to display.
Redirect styles may still generate on-screen content, however it's down to the style itself to ensure the content is presented to the end user in an appropriate manner and in-keeping with Snarl's methodology.
 
All styles are provided by a Style Engine, a small COM dll that provides an API between Snarl and the styles themselves.  Creating a full-blown style engine can be quite complex, and requires a COM-compatible language such as .net, VB6 or Delphi.  If you fancy turning your hand to this, you can read Sven's excellent .net Style Engine tutorial here.
 
Alternatively, there are a number of Style Engines which are extensible, allowing for users and developers alike to create their own styles quickly, easily, and without expensive development software.

Runnable Styles

Runnable styles are - as the name suggests - small executables which are run by Snarl to generate an image which will be used as the content to display.  This model gives developers of display styles the best of both worlds: they have full control over the resulting content and size; Snarl retains control over where the content is displayed and how the user interacts with it.  Alectric and Anarchic are both Runnable styles.
 

Web Forwarders

Web Forwarders are redirect styles so they don't generate on-screen content, instead they send the content to a remote web service (e.g. Prowl).  Web Forwarders are simple text files which can be created using the WebForward style GUI, or manually using a text editor.
 

Scripted Redirects

Coming soon, scripted redirects will allow you to create incredibly powerful redirect styles using nothing more than notepad.exe.

Run Files

Details coming soon.

Extensions

Extensions are small modules which run within Snarl's process space and generate notifications just as regular applications do, the only difference being that they don't run as a separate Windows process.

Full details on extension development and the API will be available shortly, in the meantime you can follow Toke's excellent .net tutorial.

Developing for Snarl itself

Submitting Patches

At the moment we have no formal method of accepting patches to the Snarl codebase.  If you'd like to submit a patch, in the first instance raise a request on the Developer Forum and we'll guide you through the process.

Source Code

Snarl's code is hosted on SourceForge using SVN.  This link will take you to the landing page which allows you to browse the source tree and provides instructions on how to check the source code out.

Development Blog

This is Chris' own blog - here he posts tutorials, guides and updates on Snarl development.

Developer Forum

The developer forum is focussed on supporting developers adding Snarl support to their applications.
 
Comments