Reference

# Module `naughty`

Notification library

Author:

koniu <gkusnierz@gmail.com>

Copyright© 2008 koniu

Release: v3.4.11

## Functions

destroy (notification) | Destroy notification by notification object
notify (args, 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.
resume () | Resume notifications
suspend () | Suspend notifications
toggle () | Toggle notification state

## Tables

config | Naughty configuration - a table containing common popup settings.
config.presets | Notification Presets - a table containing presets for different purposes Preset is a table of any parameters available to notify() You have to pass a reference of a preset in your notify() call to use the preset At least the default preset named "normal" has to be defined The presets "low", "normal" and "critical" are used for notifications over DBUS
notifications[screen][position] | Index of notifications.

## Functions

destroy (notification)
  Destroy notification by notification object

  ### Parameters

  - notification: Notification object to be destroyed

  ### Return value:

  True if the popup was successfully destroyed, nil otherwise
notify (args, 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

  - args:
  - 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

  ### Usage:

  naughty.notify({ title = "Achtung!", text = "You're idling", timeout = 0 })

  ### Return value:

  The notification object
resume ()
  Resume notifications
suspend ()
  Suspend notifications
toggle ()
  Toggle notification state

## Tables

config
  Naughty configuration - a table containing common popup settings. Fields
  - padding: Space between popups and edge of the workarea. Default: 4
  - spacing: Spacing between popups. Default: 1
  - icon_dirs: List of directories that will be checked by getIcon() Default: { "/usr/share/pixmaps/", }
  - icon_formats: List of formats that will be checked by getIcon() Default: { "png", "gif" }
  - default_preset: Preset to be used by default. Default: config.presets.normal
  - 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
config.presets
  Notification Presets - a table containing presets for different purposes Preset is a table of any parameters available to notify() You have to pass a reference of a preset in your notify() call to use the preset At least the default preset named "normal" has to be defined 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
notifications[screen][position]
  Index of notifications. 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