From 8768241ed9f2537fa01028e6e43edb71354f3ef3 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Wed, 3 Oct 2007 13:08:14 +0200 Subject: README: updated to recent API change darcs-hash:20071003110814-d6583-3bfbbcd810259ab545645ee62ce4b162ef39eb6e.gz --- README | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/README b/README index 4205d87..1db127b 100644 --- a/README +++ b/README @@ -267,14 +267,23 @@ Writing a plugin for Xmobar should be very simple. You need to create a data type with at least one constructor. Next you must declare this data type an instance of the Exec class, by -defining the 1 needed method (start) and one optional one (alias): +defining the 1 needed method (alternatively "start" or "run") and one +optional one (alias): - start :: e -> (String -IO ()) -> IO () + start :: e -> (String -> IO ()) -> IO () + run :: e -> IO String alias :: e -> String "start" must receive a callback to be used to display the String -produced by the plugin. "alias" is the name to be used in the output -template. Default alias will be the data type constructor. +produced by the plugin. This method can be used for plugins that need +to perform asynchronous actions, or that need to set a refresh rate. +See Plugins/Date.hs or Plugins/PipeReader.hs for examples. + +"run" can be used for simpler plugins, that must be run every second. +See Plugins/HelloWorld.hs for an example. + +"alias" is the name to be used in the output template. Default alias +will be the data type constructor. That requires importing the plugin API (the Exec class definition), that is exported by Plugins.hs. So you just need to import it in your -- cgit v1.2.3