diff options
author | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-10-03 13:08:14 +0200 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-10-03 13:08:14 +0200 |
commit | 8768241ed9f2537fa01028e6e43edb71354f3ef3 (patch) | |
tree | cc4ddc4174c0302772fee7ed035e0f552b06acb9 | |
parent | d7778c081a053cf571b041ed6f6d21c11e502912 (diff) | |
download | xmobar-8768241ed9f2537fa01028e6e43edb71354f3ef3.tar.gz xmobar-8768241ed9f2537fa01028e6e43edb71354f3ef3.tar.bz2 |
README: updated to recent API change
darcs-hash:20071003110814-d6583-3bfbbcd810259ab545645ee62ce4b162ef39eb6e.gz
-rw-r--r-- | README | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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 |