summaryrefslogtreecommitdiffhomepage
path: root/readme.md
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2018-12-02 06:07:29 +0000
committerjao <jao@gnu.org>2018-12-02 06:08:37 +0000
commit2ff796f843bbd51e7cd0aa24b7b98251d263e487 (patch)
treef2f13f84ebf4e76cb1d6d57d2e91ec018e62073f /readme.md
parent6fc4f0cfcb809b51048e6a3d952b9c887e07b13b (diff)
downloadxmobar-2ff796f843bbd51e7cd0aa24b7b98251d263e487.tar.gz
xmobar-2ff796f843bbd51e7cd0aa24b7b98251d263e487.tar.bz2
Example xmobar.hs
Diffstat (limited to 'readme.md')
-rw-r--r--readme.md71
1 files changed, 10 insertions, 61 deletions
diff --git a/readme.md b/readme.md
index 98dc345..d316acb 100644
--- a/readme.md
+++ b/readme.md
@@ -1501,74 +1501,23 @@ This implementation is equivalent to the one you can read in
`alias` is the name to be used in the output template. Default alias
will be the data type constructor.
-Implementing a plugin requires importing the plugin API (the `Exec`
-class definition), that is exported by `Plugins.hs`. So you just need
-to import it in your module with:
-
- import Plugins
-
After that your type constructor can be used as an argument for the
Runnable type constructor `Run` in the `commands` list of the
configuration options.
-This requires importing your plugin into `Config.hs` and adding your
-type to the type list in the type signature of `Config.runnableTypes`.
-
-For a very basic example see `examples/Plugins/HelloWorld.hs` or the
-other plugins that are distributed with xmobar.
-
-## Installing/Removing a Plugin
-
-Installing a plugin should require 3 steps. Here we are going to
-install the HelloWorld plugin that comes with xmobar, assuming that
-you copied it to `src/Plugins`:
-
-1. import the plugin module in `Config.hs`, by adding:
-
- import Plugins.HelloWorld
-
-2. add the plugin data type to the list of data types in the type
- signature of `runnableTypes` in `Config.hs`. For instance, for the
- HelloWorld plugin, change `runnableTypes` into:
-
- runnableTypes :: Command :*: Monitors :*: HelloWorld :*: ()
- runnableTypes = undefined
-
-3. Rebuild and reinstall xmobar. Now test it with:
-
- xmobar Plugins/helloworld.config
-
-As you may see in the example configuration file, the plugin can be
-used by adding, in the `commands` list:
-
- Run HelloWorld
-
-and, in the output template, the alias of the plugin:
-
- %helloWorld%
-
-That's it.
-
-To remove a plugin, just remove its type from the type signature of
-runnableTypes and remove the imported modules.
-
-To remove the system monitor plugin:
-
-1. remove, from `Config.hs`, the line
-
- import Plugins.Monitors
-
-2. in `Config.hs` change
-
- runnableTypes :: Command :*: Monitors :*: ()
- runnableTypes = undefined
+## Using a Plugin
- to
+To use your new plugin, you need to use a pure Haskell configuration
+for xmobar, and load your definitions there. You can see an example
+in [examples/xmobar.hs] showing you how to write a Haskell
+configuration that uses a new plugin, all in one file.
- runnableTypes :: Command :*: ()
- runnableTypes = undefined
+When xmobar runs with the full path to that Haskell file as its
+argument (or if you put it in `~/.config/xmobar/xmobar.hs`), and with
+the xmobar library installed, the Haskell code will be compiled as
+needed, and the new executable spawned for you.
-3. rebuild xmobar.
+That's it!
# Authors and credits