Notifications is an addon that does nothing by itself, but allows other addons to easily show a notification banner at the top of the screen which can display a message + the name of the addon, an icon, play a sound, animate when showing and hiding, and optionally execute a function when clicked. If no icon is provided, the default icon is shown.
If more notifications come in while one is still showing, they will be displayed one by one, so you have time to read and react to each of them.
Additionally, when you are away, these notifications are stored and shown to you as soon as you come back. If you have unread notifications when you log out, they will be shown to you when you log back in.
Moving the cursor over the banner prevents it from disappearing as long as the cursor is in place. Clicking it will execute the function specified by the addon upon display if present, and dismiss the banner. Right-clicking will only dismiss the banner. To dismiss all incoming banners with one click, hold shift.
Type '/testalert' to show a test notification. '/testalert true' shows a custom icon.
Examples of usage in addons is notifying you of incoming mail, calendar events, whispers while you are afk, UI messages, etc. It all depends on the people implementing it.
There are in-game options for simple settings. These can be accessed through the default AddOns settings panel, or by typing /notifications.
Users can also change all options including appearance at the top of notifications.lua, including appearance and animation behaviour. Explanation is added where necessary.
Developers who include Notifications in their UI can modify it in their code, allowing users to update Notifications without needing to edit the lua code. Read the 'Developer' section below for more info.
EventNotifier - alerts you of mail, calendar events and guild events.
(function) clickFunc (optional): function to execute on click. Set to nil when not using, but still adding a texture.
(string) texture (optional): path of a texture to use for the icon. Default icon is shown if omitted.
(numbers) ... (optional): arguments passed to SetTexCoord() for the icon; defaults to .08, .92, .08, .92 if omitted.
Your addon's name is passed automatically and does not need to be provided as a parameter.
You can also customize the behaviour and appearance of Notifications when embedded in your UI, so that users can update this addon without having to wait for you to upload a custom version.
Add Notifications as an optional dependency to your addon's ToC, and make sure it is loaded before accessing the options through Notifications.options. After your edits, call Notifications:Update() to apply the new settings.
This example code applies the Tukui style to Notifications if it is loaded.
## OptionalDeps: Notifications, Tukui
if Notifications and Tukui then
-- locally import option table references
local options = Notifications.options
local _, C =unpack(Tukui)
local borderR, borderG, borderB =unpack(C.general.bordercolor)
Added an in-game options GUI with a few settings. It will be expanded in the future. Includes a command (/notifications) to open.
Added Aurora theme support for this GUI.
Banner now expands on when hovering the cursor over it if the text is truncated.
Unread notifications are now stored on logout and shown on login.
You can now shift-click the banner to dismiss all incoming alerts.
The banner should now appear over all other UI frames apart from tooltips.