chanibal / toast

Notification utility for Windows, WSL, and MacOS
MIT License
0 stars 0 forks source link

Plugin architecture #1

Closed chanibal closed 3 years ago

chanibal commented 4 years ago

Outputs will be functions in a namespace, ex. echo the body | toast -o notification,mail "the message" executes toast_notification "the message" "the body" and toast_mail "the message" "the body".

Configuration file in $XDG_CONFIG_HOME/.toast should be sourced, any plugins should be placed there.
Note: if $XDG_CONFIG_HOME is unset, use ~/.config/ (source). Maybe some kind of TOAST_CONFIG override?

In the configuration file, both configuration and user plugins can be kept. Also some kind of override for the --outputs option.

Good ideas for plugins:

  1. notification (current)
  2. mqtt
  3. webhook (to simple to generalize? it might be easier to just write a curl handler)
  4. push (android push, some kind of default provider?)

Each plugin takes care of its own configuration, but its recommended to use the PLUGIN_TOAST_${PLUGIN_NAME}_${CONFIG_KEY} namespace. Ex for plugin mqtt some config might be: PLUGIN_TOAST_MQTT_USERNAME.