Module naughty
Info:
- Author: koniu <gkusnierz@gmail.com>
- Release: v3.5.1
- Copyright: 2008 koniu
Functions
suspend () | Suspend notifications |
resume () | Resume notifications |
toggle () | Toggle notification state |
destroy (notification) | Destroy notification by notification object |
notify (text, title, timeout, hover_timeout, screen, position, ontop, height, width, font, icon, icon_size, fg, bg, border_width, border_color, run, preset, replaces_id, callback) | Create notification. |
Tables
naughty | Notification library |
config | Naughty configuration - a table containing common popup settings. |
naughty.config.icon_dirs | List of directories that will be checked by getIcon() Default: { "/usr/local/share/pixmaps/", } |
naughty.config.icon_formats | List of formats that will be checked by getIcon() Default: { "png", "gif" } |
naughty.config.presets | Notification Presets - a table containing presets for different purposes Preset is a table of any parameters available to notify(), overriding default values (@see defaults) You have to pass a reference of a preset in your notify() call to use the preset The presets "low", "normal" and "critical" are used for notifications over DBUS |
naughty.config.defaults | Default values for the params to notify(). |
naughty.config.mapping | DBUS notification to preset mapping The first element is an object containing the filter If the rules in the filter matches the associated preset will be applied The rules object can contain: urgency, category, appname The second element is the preset |
notifications | Index of notifications per screen and position. |
Fields
naughty.config.padding | Space between popups and edge of the workarea. |
naughty.config.spacing | Spacing between popups. |
naughty.config.notify_callback | Callback used to modify or reject notifications. |
Functions
- suspend ()
- Suspend notifications
- resume ()
- Resume notifications
- toggle ()
- Toggle notification state
- destroy (notification)
-
Destroy notification by notification object
Parameters:
- notification Notification object to be destroyed
Returns:
-
True if the popup was successfully destroyed, nil otherwise
- notify (text, title, timeout, hover_timeout, screen, position, ontop, height, width, font, icon, icon_size, fg, bg, border_width, border_color, run, preset, replaces_id, callback)
-
Create notification. args is a dictionary of (optional) arguments.
Parameters:
- text Text of the notification. Default: ''
- title Title of the notification. Default: nil
- timeout Time in seconds after which popup expires. Set 0 for no timeout. Default: 5
- hover_timeout Delay in seconds after which hovered popup disappears. Default: nil
- screen Target screen for the notification. Default: 1
- position Corner of the workarea displaying the popups. Values: "top_right" (default), "top_left", "bottom_left", "bottom_right".
- ontop Boolean forcing popups to display on top. Default: true
- height Popup height. Default: nil (auto)
- width Popup width. Default: nil (auto)
- font Notification font. Default: beautiful.font or awesome.font
- icon Path to icon. Default: nil
- icon_size Desired icon size in px. Default: nil
- fg Foreground color. Default: beautiful.fg_focus or '#ffffff'
- bg Background color. Default: beautiful.bg_focus or '#535d6c'
- border_width Border width. Default: 1
- border_color Border color. Default: beautiful.border_focus or '#535d6c'
- run Function to run on left click. Default: nil
- preset Table with any of the above parameters. Note: Any parameters specified directly in args will override ones defined in the preset.
- replaces_id Replace the notification with the given ID
- callback function that will be called with all arguments the notification will only be displayed if the function returns true note: this function is only relevant to notifications sent via dbus
Returns:
-
The notification object
Usage:
naughty.notify({ title = "Achtung!", text = "You're idling", timeout = 0 })
Tables
- naughty
- Notification library
- config
- Naughty configuration - a table containing common popup settings.
- naughty.config.icon_dirs
-
List of directories that will be checked by getIcon()
Default: { "/usr/local/share/pixmaps/", }
Fields:
- /usr/local/share/pixmaps/
- naughty.config.icon_formats
-
List of formats that will be checked by getIcon()
Default: { "png", "gif" }
Fields:
- png
- gif
- naughty.config.presets
-
Notification Presets - a table containing presets for different purposes
Preset is a table of any parameters available to notify(), overriding default
values (@see defaults)
You have to pass a reference of a preset in your notify() call to use the preset
The presets "low", "normal" and "critical" are used for notifications over DBUS
Fields:
- low The preset for notifications with low urgency level
- normal The default preset for every notification without a preset that will also be used for normal urgency level
- critical The preset for notifications with a critical urgency level
- naughty.config.defaults
-
Default values for the params to notify().
These can optionally be overridden by specifying a preset
Fields:
- timeout
- text
- screen
- ontop
- margin
- border_width
- position
see also:
- naughty.config.mapping
-
DBUS notification to preset mapping
The first element is an object containing the filter
If the rules in the filter matches the associated preset will be applied
The rules object can contain: urgency, category, appname
The second element is the preset
Fields:
- {
- notifications
-
Index of notifications per screen and position. See config table for valid
'position' values. Each element is a table consisting of:
Fields:
- box Wibox object containing the popup
- height Popup height
- width Popup width
- die Function to be executed on timeout
- id Unique notification id based on a counter
Fields
- naughty.config.padding
- Space between popups and edge of the workarea. Default: 4
- naughty.config.spacing
- Spacing between popups. Default: 1
- naughty.config.notify_callback
- Callback used to modify or reject notifications. Default: nil Example: naughty.config.notify_callback = function(args) args.text = 'prefix: ' .. args.text return args end