Closed joncrangle closed 3 months ago
I personally think the toast notification is very obstructive, so I would personally not use it for anything other than errors. I dont mind the feature if it is opt-in/out, so what you are proposing might be good.
Is it something you are interested in using, if so then I am all for it 😄 But if you are not, then it could be implemented but be turned off for all notifications except errors
I'll play around with this feature a bit and make sure to set the defaults to only show a toast on_error
. Personally, I would only use toasts on_save
and on_error
. I don't think an on_resurrect
option is particularly useful since it is obvious when this succeeds. An on_periodic_save
would be intrusive, but I could provide this option and disable it by default.
To send a toast, the user would need to call functions passing in a window
object, so if no window
object is passed in there wouldn't be any toasts. I'll make sure everything still operates without this opt to make sure the current API still works as-is.
What if there was an event emitted when saving, resurrecting and for the periodic save via. wezterm.emit, then there could be a default wezterm.on callback which could show the toast (for on save only if that is what should be default). This could of course be disabled/enabled at will for the user. This would also make it possible for users to have other callback functions when these events are emitted
And then keep the toasts for on_error
without a wezterm.emit?
Now that you bring up wezterm.emit, I think this is a better option than including toasts within the plugin.
We could leave it entirely up to the user to setup wezterm.on events in their config if they would like toasts.
We could emit events and errors and provide sample code in the docs about how to create toasts from these events, but the emitted events could be used for other purposes (for instance someone might want to initiate a syncthing process on save, or their own encryption mechanism outside of the plugin).
I will make a new issue for implementing wezterm.on
in the various functions.
I do like the idea of having some toast notification when an error occurs, like if there is an error when writing the file or if the user is trying to use encryption but havn't done the setup with their keys ect. Will also open a new issue for this
Looking for your thoughts on a feature to initiate a toast notification following successful/unsuccessful plugin events. We could let the user override defaults according to their preference.
Wezterm provides a window:toast_notification() that we can use to provide some optional feedback:
Defaults could look something like:
Then, depending on the value of default_notifications we could run a
window:toast_notification
function.