diff --git a/Plugins.md b/Plugins.md index 788f740..525ea7c 100644 --- a/Plugins.md +++ b/Plugins.md @@ -17,13 +17,13 @@ # How to create new plugin -Themes need to define the following functions +> Note: Replace `pluginname` with actual plugin name -> Note: Replace `plugin_name` with actual plugin name +Plugins need to be defined in a file named `pluginname.sh`. Plugins are sourced from `$XDG_CONFIG_HOME/wish/plugins`, `/usr/share/wish/plugins` and `$HOME/.config/wish/plugins`. All keys from config are set as environment variables of the form `WISH_PLUGINNAME_KEY`. The following functions need to be defined in `pluginname.sh`. -+ `wish_plugin_name_set_colors` - This function is called after the theme. This allows the plugin to override the theme or set defaults if the theme has not themed some elements of the plugin. Although plugins are allowed to override themes, it is not recommended. -+ `wish_plugin_name_start` - This function should return 0 or 1 if it allows/disallows powerline before it respectively. -+ `wish_plugin_name_end` - This function should return 0 or 1 if it allows/disallows powerline before it respectively. -+ `wish_plugin_name_main` - This function is called every time a prompt is generated. Ensure to run `wish_append bg_color fg_color text` within this function. Although the plugin can override the theme while running `wish_append`, it is not recommended. ++ `wish_pluginname_set_colors` - This function is called after the theme. This allows the plugin to override the theme or set defaults if the theme has not themed some elements of the plugin. Although plugins are allowed to override themes, it is not recommended. ++ `wish_pluginname_start` - This function should return 0 or 1 if it allows/disallows powerline before it respectively. ++ `wish_pluginname_end` - This function should return 0 or 1 if it allows/disallows powerline before it respectively. ++ `wish_pluginname_main` - This function is called every time a prompt is generated. Ensure to run `wish_append bg_color fg_color text` within this function. Although the plugin can override the theme while running `wish_append`, it is not recommended. Check [dummy plugin](https://gitlab.com/ceda_ei/wish/blob/master/plugins/dummy.sh).