Class naughty.notification

A notification object.

This class creates individual notification objects that can be manipulated to extend the default behavior.

This class doesn’t define the actual widget, but is rather intended as a data object to hold the properties. All examples assume the default widgets, but the whole implementation can be replaced.

Info:

  • Copyright: 2008 koniu,2017 Emmanuel Lepage Vallee
  • Author: Emmanuel Lepage Vallee

Functions

naughty.notification (args[, opt=""]) Create a notification.

Object properties

title Title of the notification.
timeout Time in seconds after which popup expires.
hover_timeout Delay in seconds after which hovered popup disappears.
screen Target screen for the notification.
position Corner of the workarea displaying the popups.
ontop Boolean forcing popups to display on top.
height Popup height.
width Popup width.
font Notification font.
icon Path to icon.
icon_size Desired icon size in px.
fg Foreground color.
bg Background color.
border_width Border width.
border_color Border color.
shape Widget shape.
opacity Widget opacity.
margin Widget margin.
run Function to run on left click.
destroy Function to run when notification is destroyed.
preset Table with any of the above parameters.
replaces_id Replace the notification with the given ID.
callback Function that will be called with all arguments.
actions A table containing strings that represents actions to buttons.
ignore Ignore this notification, do not display.
suspended Tell if the notification is currently suspended (read only).
is_expired If the notification is expired.

Signals

destroyed Emitted when the notification is destroyed.

Theme variables

beautiful.notification_font Notifications font.
beautiful.notification_bg Notifications background color.
beautiful.notification_fg Notifications foreground color.
beautiful.notification_border_width Notifications border width.
beautiful.notification_border_color Notifications border color.
beautiful.notification_shape Notifications shape.
beautiful.notification_opacity Notifications opacity.
beautiful.notification_margin Notifications margin.
beautiful.notification_width Notifications width.
beautiful.notification_height Notifications height.

Methods

naughty.notification:destroy (reason[, keep_visible=false]) Destroy notification by notification object.
naughty.notification:reset_timeout (new_timeout) Set new notification timeout.


Functions

Methods
naughty.notification (args[, opt=""])
Create a notification.
  • args The argument table containing any of the arguments below.
    • shape gears.shape Widget shape. (default `beautiful.notification_shape`)
    • opacity gears.opacity Widget opacity. (default `beautiful.notification_opacity`)
    • margin gears.margin Widget margin. (default `beautiful.notification_margin`)
    • run func Function to run on left click. The notification object will be passed to it as an argument. You need to call e.g. notification.die(naughty.notification_closed_reason.dismissedByUser) from there to dismiss the notification yourself. (optional)
    • destroy func Function to run when notification is destroyed. (optional)
    • preset table Table with any of the above parameters. Note: Any parameters specified directly in args will override ones defined in the preset. (optional)
    • replaces_id int Replace the notification with the given ID. (optional)
    • callback func 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. (optional)
    • actions table A list of naughty.actions. (optional)
    • ignore_suspend bool If set to true this notification will be shown even if notifications are suspended via naughty.suspend. (default false)
  • opt string =beautiful.notification_border_color or beautiful.border_focus or '#535d6c'] args.border_color Border color.

Returns:

    optional table The notification object, or nil in case a notification was not displayed.

Usage:

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

Object properties

title
Title of the notification.

Type:

  • string
timeout
Time in seconds after which popup expires. Set 0 for no timeout.

Type:

  • number
hover_timeout
Delay in seconds after which hovered popup disappears.

Type:

  • number
screen
Target screen for the notification.

Type:

  • screen
position

Corner of the workarea displaying the popups.

The possible values are:

  • top_right
  • top_left
  • bottom_left
  • bottom_right
  • top_middle
  • bottom_middle

Type:

  • string
ontop
Boolean forcing popups to display on top.

Type:

  • boolean
height
Popup height.

Type:

  • number
width
Popup width.

Type:

  • number
font
Notification font.

Type:

  • string
icon
Path to icon.

Type:

icon_size
Desired icon size in px.

Type:

  • number
fg
Foreground color.

Type:

See also:

bg
Background color.

Type:

See also:

border_width
Border width.

Type:

  • number

See also:

border_color
Border color.

Type:

  • string

See also:

shape
Widget shape.
opacity
Widget opacity.

Type:

  • number From 0 to 1
margin
Widget margin.

Type:

See also:

run
Function to run on left click.

Type:

  • function
destroy
Function to run when notification is destroyed.

Type:

  • function
preset
Table with any of the above parameters. args will override ones defined in the preset.

Type:

  • table
replaces_id
Replace the notification with the given ID.

Type:

  • number
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.

Type:

  • function
actions
A table containing strings that represents actions to buttons.

The table key (a number) is used by DBus to set map the action.

Type:

  • table
ignore
Ignore this notification, do not display.

Note that this property has to be set in a preset or in a request::preset handler.

Type:

  • boolean
suspended
Tell if the notification is currently suspended (read only).

This is always equal to naughty.suspended

Type:

  • boolean
is_expired
If the notification is expired.

Type:

  • boolean

See also:

Signals

destroyed
Emitted when the notification is destroyed.

Arguments:

  • reason number Why it was destroyed
  • keep_visible boolean If it was kept visible.

See also:

Theme variables

beautiful.notification_font
Notifications font.

Type:

  • notification_font string or lgi.Pango.FontDescription
beautiful.notification_bg
Notifications background color.

Type:

  • notification_bg color
beautiful.notification_fg
Notifications foreground color.

Type:

  • notification_fg color
beautiful.notification_border_width
Notifications border width.

Type:

  • notification_border_width int
beautiful.notification_border_color
Notifications border color.

Type:

  • notification_border_color color
beautiful.notification_shape
Notifications shape.

Type:

  • notification_shape gears.shape (optional)

See also:

beautiful.notification_opacity
Notifications opacity.

Type:

  • notification_opacity int (optional)
beautiful.notification_margin
Notifications margin.

Type:

  • notification_margin int
beautiful.notification_width
Notifications width.

Type:

  • notification_width int
beautiful.notification_height
Notifications height.

Type:

  • notification_height int

Methods

naughty.notification:destroy (reason[, keep_visible=false])
Destroy notification by notification object.
  • reason string One of the reasons from notification_closed_reason
  • keep_visible boolean If true, keep the notification visible (default false)

Returns:

    True if the popup was successfully destroyed, false otherwise
naughty.notification:reset_timeout (new_timeout)
Set new notification timeout.
  • new_timeout number Time in seconds after which notification disappears.
generated by LDoc 1.4.6 Last updated 2030-01-01 00:00:00