mirror of https://github.com/Hilbis/Hilbish
1.5 KiB
1.5 KiB
title | description | layout | menu | ||||
---|---|---|---|---|---|---|---|
Notification | Get notified of shell actions. | doc |
|
Hilbish features a simple notification system which can be
used by other plugins and parts of the shell to notify the user
of various actions. This is used via the hilbish.message
interface.
A message
is defined as a table with the following properties:
icon
: A unicode/emoji icon for the notification.title
: The title of the messagetext
: Message text/bodychannel
: The source of the message. This should be a unique and easily readable text identifier.summary
: A short summary of the notification and message. If this is not present and you are using this to display messages, you should take part of thetext
instead.
The hilbish.message
interface provides the following functions:
send(message)
: Sends a message and emits thehilbish.notification
signal. DO NOT emit thehilbish.notification
signal directly, or the message will not be stored by the message handler.read(idx)
: Marks message atidx
as read.delete(idx)
: Removes message atidx
.readAll()
: Marks all messages as read.clear()
: Deletes all messages.
There are a few simple use cases of this notification/messaging system. It could also be used as some "inter-shell" messaging system (???) but is intended to display to users.
An example is notifying users of completed jobs/commands ran in the background. Any Hilbish-native command (think the upcoming Greenhouse pager) can display it.