Module naughty
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/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: niltimeout: Time in seconds after which popup expires. Set 0 for no timeout. Default: 5hover_timeout: Delay in seconds after which hovered popup disappears. Default: nilscreen: Target screen for the notification. Default: 1position: 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: trueheight: Popup height. Default: nil (auto)width: Popup width. Default: nil (auto)font: Notification font. Default: beautiful.font or awesome.fonticon: Path to icon. Default: nilicon_size: Desired icon size in px. Default: nilfg: Foreground color. Default: beautiful.fg_focus or '#ffffff'bg: Background color. Default: beautiful.bg_focus or '#535d6c'border_width: Border width. Default: 1border_color: Border color. Default: beautiful.border_focus or '#535d6c'run: Function to run on left click. Default: nilpreset: 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 IDcallback: 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
Usage:
naughty.notify({ title = "Achtung!", text = "You're idling", timeout = 0 })Returns:
-
The notification object
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/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 levelnormal: The default preset for every notification without a preset that will also be used for normal urgency levelcritical: 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
- 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 popupheight: Popup heightwidth: Popup widthdie: Function to be executed on timeoutid: 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