Module: naughty.notification
Notification manipulation class.
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
-
Originally authored by: Emmanuel Lepage Vallee
(Full contributors list available on our github project)
Constructors
| naughty.notification {[args]} | Create a notification. |
Object properties
| title | string | Title of the notification. | |
| timeout | number | Time in seconds after which popup expires. | |
| urgency | string | The notification urgency level. | |
| category | string or nil | The notification category. | |
| resident | boolean | True if the notification should be kept when an action is pressed. | |
| hover_timeout | number or nil | Delay in seconds after which hovered popup disappears. | |
| screen | screen | Target screen for the notification. | |
| position | string or nil | Corner of the workarea displaying the popups. | |
| ontop | boolean | Boolean forcing popups to display on top. | |
| height | number or nil | Popup height. | |
| width | number or nil | Popup width. | |
| font | font or nil | Notification font. | |
| icon | image or nil | "All in one" way to access the default image or icon. | |
| icon_size | integer or nil | Desired icon size in px. | |
| app_icon | string or nil | The icon provided in the app_icon field of the DBus notification. | |
| image | image or nil | The notification image. | |
| images | nil or table | The notification (animated) images. | |
| fg | color or nil | Foreground color. | |
| bg | color or nil | Background color. | |
| border_width | number or nil | Border width. | |
| border_color | string or nil | Border color. | |
| shape | shape or nil | Widget shape. | |
| opacity | number or nil | Widget opacity. | |
| margin | number or table or nil | Widget margin. | |
| preset | table or nil | Table with any of the above parameters. | |
| callback | function or nil | Function that will be called with all arguments. | |
| actions | table | A table containing strings that represents actions to buttons. | |
| ignore | boolean | Ignore this notification, do not display. | |
| suspended | boolean | Tell if the notification is currently suspended (read only). | |
| is_expired | boolean | If the notification is expired. | |
| auto_reset_timeout | boolean | If the timeout needs to be reset when a property changes. | |
| clients | table | A list of clients associated with this notification. | |
| max_width | number or nil | The maximum popup width. | |
| app_name | string or nil | The application name specified by the notification. | |
| widget_template | template or nil | The widget template used to represent the notification. |
Deprecated object properties
| text | string | Text of the notification. | Deprecated |
| run | function | Function to run on left click. | Deprecated |
| destroy | function | Function to run when notification is destroyed. | Deprecated |
Object methods
| :destroy (reason, keep_visible) -> boolean | Destroy notification by notification object. | |
| :reset_timeout (new_timeout) | Set new notification timeout. | |
| :append_actions (new_actions) | Add more actions to the notification. | |
| :grant (permission, context) | Grant a permission for a notification. | |
| :deny (permission, context) | Deny a permission for a notification | |
| :emit_signal (name, ...) | Emit a signal. | Inherited from gears.object |
| :connect_signal (name, func) | Connect to a signal. | Inherited from gears.object |
| :weak_connect_signal (name, func) | Connect to a signal weakly. | Inherited from gears.object |
Signals
| destroyed | Emitted when the notification is destroyed. |
Theme variables
| beautiful.notification_font | string or lgi.Pango.FontDescription | Notifications font. | |
| beautiful.notification_bg | color | Notifications background color. | |
| beautiful.notification_fg | color | Notifications foreground color. | |
| beautiful.notification_border_width | int | Notifications border width. | |
| beautiful.notification_border_color | color | Notifications border color. | |
| beautiful.notification_shape | gears.shape | Notifications shape. | |
| beautiful.notification_opacity | int | Notifications opacity. | |
| beautiful.notification_margin | int | The margins inside of the notification widget (or popup). | |
| beautiful.notification_width | int | Notifications width. | |
| beautiful.notification_height | int | Notifications height. | |
| beautiful.notification_spacing | number | The spacing between the notifications. |
Constructors
- 🔗 naughty.notification {[args]}
-
Create a notification.
Parameters:
Note: This constructors uses named parameters calling convention. It means you call it with{}and omit the parantheses. For example, calling this will all default argument would benaughty.notification{}. This is a Lua shortcut syntax equivalent tonaughty.notification({}).argsis only a placeholder name for the "lone table argument" used in named parameters calls.Name Type(s) Description Default value args Optional table The argument table containing any of the arguments below. {}text Optional string Text of the notification. ""title Optional string Title of the notification. Undefined timeout Optional integer Time in seconds after which popup expires. Set 0 for no timeout. 5hover_timeout Optional number Delay in seconds after which hovered popup disappears. Undefined screen Optional integer or screen Target screen for the notification. focusedposition Optional string Corner of the workarea displaying the popups. Values: "top_right","top_left","bottom_left","bottom_right","top_middle","bottom_middle","middle"."top_right"ontop Optional boolean Boolean forcing popups to display on top. trueheight Optional integer Popup height. `beautiful.notification_height` or autowidth Optional integer Popup width. `beautiful.notification_width` or autofont Optional string or lgi.Pango.FontDescription Notification font. `beautiful.notification_font` or `beautiful.font` or `awesome.font`icon Optional image Path to icon. Undefined icon_size Optional integer Desired icon size in px. Undefined fg Optional string Foreground color. `beautiful.notification_fg` or `beautiful.fg_focus` or `'#ffffff'`bg Optional string Background color. `beautiful.notification_fg` or `beautiful.bg_focus` or `'#535d6c'`border_width Optional integer Border width. `beautiful.notification_border_width` or 1border_color Optional gears.color Border color. `beautiful.notification_border_color` or `beautiful.border_color_active` or `'#535d6c'`shape Optional gears.shape Widget shape. beautiful.notification_shapeopacity Optional gears.opacity Widget opacity. beautiful.notification_opacitymargin Optional gears.margin Widget margin. beautiful.notification_marginrun Optional function 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.Undefined destroy Optional function Function to run when notification is destroyed. Undefined preset Optional table Table with any of the above parameters. Note: Any parameters specified directly in args will override ones defined in the preset. Undefined callback Optional function 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. Undefined actions Optional table A list of naughty.actions. Undefined ignore_suspend Optional boolean If set to true this notification will be shown even if notifications are suspended via naughty.suspend. falseReturns:
-
naughty.notification
A new notification object.
Usage:
naughty.notification { title = "Achtung!", message = "You're idling", timeout = 0 }
Click to display more Consumed theme variables:
Object properties
- 🔗 title string · 1 signal
-
Title of the notification.
Constraints:
Default value : ""
Click to display more Emit signals:
property::titleWhen the title value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuetitle The new value affected to the property.
- 🔗 timeout number · 1 signal
-
Time in seconds after which popup expires.
Set 0 for no timeout.
Constraints:
Default value : If unspecified, it can come from either the notification itself, the presets or the ruled.notificationrules.Unit : second Negative allowed : false
Click to display more Emit signals:
property::timeoutWhen the timeout value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuetimeout The new value affected to the property.
- 🔗 urgency string · 1 signal
-
The notification urgency level.
Constraints:
Default value : "normal"Valid values: "low""normal""critical"
Click to display more Emit signals:
property::urgencyWhen the urgency value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueurgency The new value affected to the property.
- 🔗 category string or nil · 1 signal
-
The notification category.
The category should be named using the
x-vendor.class.namenaming scheme or use one of the default categories:Name Description device A generic device-related notification that doesn't fit into any other category. device.added A device, such as a USB device, was added to the system. device.error A device had some kind of error. device.removed A device, such as a USB device, was removed from the system. email A generic e-mail-related notification that doesn't fit into any other category. email.arrived A new e-mail notification. email.bounced A notification stating that an e-mail has bounced. im A generic instant message-related notification that doesn't fit into any other category. im.error An instant message error notification. im.received A received instant message notification. network A generic network notification that doesn't fit into any other category. network.connected A network connection notification, such as successful sign-on to a network service.
This should not be confused with device.added for new network devices.network.disconnected A network disconnected notification. This should not be confused with
device.removed for disconnected network devices.network.error A network-related or connection-related error. presence A generic presence change notification that doesn't fit into any other category,
such as going away or idle.presence.offline An offline presence change notification. presence.online An online presence change notification. transfer A generic file transfer or download notification that doesn't fit into any other category. transfer.complete A file transfer or download complete notification. transfer.error A file transfer or download error. Constraints:
Default value : nil
Click to display more Emit signals:
property::categoryWhen the category value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuecategory The new value affected to the property.
- 🔗 resident boolean · 1 signal
-
True if the notification should be kept when an action is pressed.
By default, invoking an action will destroy the notification. Some actions, like the "Snooze" action of alarm clock, will cause the notification to be updated with a date further in the future.
Constraints:
Default value : falseValid values : trueorfalse.
Click to display more Emit signals:
property::residentWhen the resident value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueresident The new value affected to the property.
- 🔗 hover_timeout number or nil · 1 signal
-
Delay in seconds after which hovered popup disappears.
Constraints:
Default value : nilUnit : second Negative allowed : false
Click to display more Emit signals:
property::hover_timeoutWhen the hover_timeout value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuehover_timeout The new value affected to the property.
- 🔗 screen screen · 1 signal
-
Target screen for the notification.
Constraints:
Default value : awful.screen.preferred()Type description: screen : A valid screen object such as retured by awful.screen.focused()or mouse.screen.integer : A screen global id. Avoid using this since they are unsorted. string : The "primary"value is also valid.
Click to display more Emit signals:
property::screenWhen the screen value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuescreen The new value affected to the property.
- 🔗 position string or nil · 1 signal
-
Corner of the workarea displaying the popups.
for _, pos in ipairs { "top_left" , "top_middle" , "top_right", "bottom_left", "bottom_middle", "bottom_right", } do for i=1, 3 do naughty.notification { position = pos, title = pos .. " " .. i, message = ever_longer_messages(i) } end endConstraints:
Default value : beautiful.notification_positionValid values: "top_right""top_left""bottom_left""bottom_right""top_middle""bottom_middle""middle"See also:
awful.placement.next_to Move a drawable to a relative position next to another one. (awful.placement) static module functions
Click to display more Emit signals:
property::positionWhen the position value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueposition The new value affected to the property.
Consumed theme variables:
Theme variable Usage beautiful.notification_position - 🔗 ontop boolean
-
Boolean forcing popups to display on top.
Constraints:
Default value : falseValid values : trueorfalse. - 🔗 height number or nil · 1 signal · 1 theme variable
-
Popup height.
for _, pos in ipairs { "top_left" , "top_middle" , "top_right", "bottom_left", "bottom_middle", "bottom_right", } do for i=1, 2 do naughty.notification { position = pos, title = pos .. " " .. i, width = 50*i, height = 50*i, message = "This is a very, very, very, ".. "very, very very long message", } end endConstraints:
Default value : beautiful.naughty_notification_heightType description: nil : Fallback to the current value of beautiful.notification_height.Unit : pixel Negative allowed : false See also:
width Popup width. object properties
Click to display more Emit signals:
property::heightWhen the height value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueheight The new value affected to the property.
Consumed theme variables:
Theme variable Usage beautiful.notification_height Fallback when height isn't set. - 🔗 width number or nil · 1 signal · 1 theme variable
-
Popup width.
Constraints:
Default value : beautiful.naughty_notification_widthType description: nil : Fallback to the current value of beautiful.notification_width.Unit : pixel Negative allowed : false See also:
height Popup height. object properties
Click to display more Emit signals:
property::widthWhen the width value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuewidth The new value affected to the property.
Consumed theme variables:
Theme variable Usage beautiful.notification_width Fallback when width isn't set. - 🔗 font font or nil · 1 signal
-
Notification font.
Constraints:
Default value : beautiful.notification_fontType description: string : A Pango font description. string : An XFT string, such as "--dejavu sans mono-medium-r-normal---80-----iso10646-1".See also:
wibox.widget.textbox.font Set a textbox font. (wibox.widget.textbox) object properties Usage:
local text = [[An <b>important</b>;<i>notification</i>;]] require("naughty").notification { title = "Hello world!", text = text, icon = beautiful.icon, bg = "#0000ff", fg = "#ff0000", font = "verdana 14", border_width = 1, border_color = "#ff0000" }
Click to display more Emit signals:
property::fontWhen the font value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuefont The new value affected to the property.
Consumed theme variables:
Theme variable Usage beautiful.notification_font - 🔗 icon image or nil · 1 signal
-
"All in one" way to access the default image or icon.
A notification can provide a combination of an icon, a static image, or if enabled, a looping animation. Add to that the ability to import the icon information from the client or from a
.desktopfile, there is multiple conflicting sources of "icons".On the other hand, the vast majority of notifications don't multiple or ambiguous sources of icons. This property will pick the first of the following.
- The image.
- The app_icon.
- The icon from a client with
normaltype. - The icon of a client with
dialogtype.
Constraints:
Default value : nilType description: string : Interpreted as a path to an image file. string : A valid SVG content. cairo : A cairo image surface: Directly used as-is. librsvg : A librsvg handle object: Directly used as-is. nil : Unset the image. See also:
app_icon The icon provided in the app_icon field of the DBus notification. object properties image The notification image. object properties
Click to display more Emit signals:
property::iconWhen the icon value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueicon The new value affected to the property.
- 🔗 icon_size integer or nil · 1 signal
-
Desired icon size in px.
Constraints:
Default value : beautiful.notification_icon_sizeUnit : pixel Negative allowed : false
Click to display more Emit signals:
property::icon_sizeWhen the icon_size value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueicon_size The new value affected to the property.
Consumed theme variables:
Theme variable Usage beautiful.notification_icon_size - 🔗 app_icon string or nil · 1 signal
-
The icon provided in the app_icon field of the DBus notification.
This should always be either the URI (path) to an icon or a valid XDG icon name to be fetched from the theme.
Constraints:
Default value : nil
Click to display more Emit signals:
property::app_iconWhen the app_icon value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueapp_icon The new value affected to the property.
- 🔗 image image or nil · 1 signal
-
The notification image.
This is usually provided as a gears.surface object. The image is used instead of the app_icon by notification assets which are auto-generated or stored elsewhere than the filesystem (databases, web, Android phones, etc).
Constraints:
Default value : nilType description: string : Interpreted as a path to an image file. string : A valid SVG content. cairo : A cairo image surface: Directly used as-is. librsvg : A librsvg handle object: Directly used as-is. nil : Unset the image.
Click to display more Emit signals:
property::imageWhen the image value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueimage The new value affected to the property.
- 🔗 images nil or table · 1 signal
-
The notification (animated) images.
Note that calling this without first setting naughty.image_animations_enabled to true will throw an exception.
Also note that there is zero support for this anywhere else in naughty and very, very few applications support this.
This exists purely to comply with the specification.
Constraints:
Default value : nilTable content : A list of images.
Click to display more Emit signals:
property::imagesWhen the images value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueimages The new value affected to the property.
- 🔗 fg color or nil · 1 signal · 1 theme variable
-
Foreground color.
-- A notification popup using the default widget_template. naughty.connect_signal("request::display", function(n) naughty.layout.box {notification = n} end) -- Notifications as widgets for any <a href="../popups_and_bars/wibox.html#">wibox</a>/<a href="../popups_and_bars/awful.wibar.html#">awful.wibar</a>/<a href="../popups_and_bars/awful.popup.html#">awful.popup</a> some_wibar.widget = naughty.list.notifications {} for _, color in ipairs {"#ff0000", "#00ff00", "#0000ff"} do naughty.notification { title = "A ".. color .." notification", message = "Message", fg = color, } endConstraints:
Default value : beautiful.naughty_notification_fgType description: string : An hexadecimal color code, such as "#ff0000"for red.string : A color name, such as "red".table : A gradient table. cairo.pattern : Any valid Cairo pattern. cairo.pattern : A texture build from an image by gears.color.create_png_pattern nil : Fallback to the current value of beautiful.notification_fg.See also:
title Title of the notification. object properties gears.color This module simplifies the creation of cairo pattern objects. module
Click to display more Emit signals:
property::fgWhen the fg value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuefg The new value affected to the property.
Consumed theme variables:
Theme variable Usage beautiful.notification_fg Fallback when fg isn't set. - 🔗 bg color or nil · 1 signal
-
Background color.
-- A notification popup using the default widget_template. naughty.connect_signal("request::display", function(n) naughty.layout.box {notification = n} end) -- Notifications as widgets for any <a href="../popups_and_bars/wibox.html#">wibox</a>/<a href="../popups_and_bars/awful.wibar.html#">awful.wibar</a>/<a href="../popups_and_bars/awful.popup.html#">awful.popup</a> some_wibar.widget = naughty.list.notifications {} for _, color in ipairs {"#ff0000", "#00ff00", "#0000ff"} do naughty.notification { title = "A ".. color .." notification", bg = color, } endConstraints:
Default value : beautiful.notification_bgType description: string : An hexadecimal color code, such as "#ff0000"for red.string : A color name, such as "red".table : A gradient table. cairo.pattern : Any valid Cairo pattern. cairo.pattern : A texture build from an image by gears.color.create_png_pattern See also:
title Title of the notification. object properties gears.color This module simplifies the creation of cairo pattern objects. module
Click to display more Emit signals:
property::bgWhen the bg value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuebg The new value affected to the property.
Consumed theme variables:
Theme variable Usage beautiful.notification_bg - 🔗 border_width number or nil · 1 signal · 1 theme variable
-
Border width.
Constraints:
Default value : beautiful.notification_border_width or 0Type description: nil : Fallback to the current value of beautiful.notification_border_width.Unit : pixel Negative allowed : false
Click to display more Emit signals:
property::border_widthWhen the border_width value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueborder_width The new value affected to the property.
Consumed theme variables:
Theme variable Usage beautiful.notification_border_width Consumed theme variables:
Theme variable Usage beautiful.notification_border_width Fallback when border_width isn't set. - 🔗 border_color string or nil · 1 signal
-
Border color.
-- A notification popup using the default widget_template. naughty.connect_signal("request::display", function(n) naughty.layout.box {notification = n} end) -- Notifications as widgets for any <a href="../popups_and_bars/wibox.html#">wibox</a>/<a href="../popups_and_bars/awful.wibar.html#">awful.wibar</a>/<a href="../popups_and_bars/awful.popup.html#">awful.popup</a> some_wibar.widget = naughty.list.notifications {} for bw, color in ipairs {"#ff0000", "#00ff00", "#0000ff"} do naughty.notification { title = "A ".. color .." notification", border_color = color, border_width = bw*2, } endPlease note that only string (like
#ff0000) are supported.Constraints:
Default value : beautiful.notification_border_colorSee also:
gears.color This module simplifies the creation of cairo pattern objects. module
Click to display more Emit signals:
property::border_colorWhen the border_color value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueborder_color The new value affected to the property.
Consumed theme variables:
Theme variable Usage beautiful.notification_border_color - 🔗 shape shape or nil · 1 signal
-
Widget shape.
Note that when using a custom
request::displayhandler ornaughty.rules, choosing between multiple shapes depending on the content can be done using expressions like:-- The notification object is called <code>n</code> shape = #n.actions > 0 and gears.shape.rounded_rect or gears.shape.rounded_bar,-- A notification popup using the default widget_template. naughty.connect_signal("request::display", function(n) naughty.layout.box {notification = n} end) -- Notifications as widgets for any <a href="../popups_and_bars/wibox.html#">wibox</a>/<a href="../popups_and_bars/awful.wibar.html#">awful.wibar</a>/<a href="../popups_and_bars/awful.popup.html#">awful.popup</a> some_wibar.widget = naughty.list.notifications {} local shapes = { gears.shape.octogon, gears.shape.rounded_rect, gears.shape.rounded_bar } for idx=1, 3 do naughty.notification { title = "A notification", border_color = "#0000ff", border_width = idx*2, shape = shapes[idx], } endlocal text = [[An <b>important</b>; <i>notification</i>; ]] local shapes = { gears.shape.rounded_rect, gears.shape.hexagon, gears.shape.octogon, function(cr, w, h) return gears.shape.infobubble(cr, w, h, 20, 10, w/2 - 10) end } for _, s in ipairs(shapes) do naughty.notify { title = "Hello world!", text = text, icon = beautiful.icon, shape = s, border_width = 3, border_color = beautiful.bg_highlight, margin = 15, } endConstraints:
Default value : beautiful.notification_shapeType description: gears.shape : Like gears.shape.circle function: : This can be used for custom shapes or to set parameters of existing shapes. Function prototype: Parameters: cr (cairo.context) : A Cairo context width (number) : The area width. height (number) : The area height. Return : The function returns nothing.
Click to display more Emit signals:
property::shapeWhen the shape value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueshape The new value affected to the property.
Consumed theme variables:
Theme variable Usage beautiful.notification_shape - 🔗 opacity number or nil · 1 signal
-
Widget opacity.
Constraints:
Default value : beautiful.notification_opacityUnit : Gradient beween 0.0 (transparent) and 1.0 (opaque). Minimum value : 0.0 Maximum value : 1.0
Click to display more Emit signals:
property::opacityWhen the opacity value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueopacity The new value affected to the property.
Consumed theme variables:
Theme variable Usage beautiful.notification_opacity - 🔗 margin number or table or nil · 1 signal
-
Widget margin.
-- A notification popup using the default widget_template. naughty.connect_signal("request::display", function(n) naughty.layout.box {notification = n} end) -- Notifications as widgets for any <a href="../popups_and_bars/wibox.html#">wibox</a>/<a href="../popups_and_bars/awful.wibar.html#">awful.wibar</a>/<a href="../popups_and_bars/awful.popup.html#">awful.popup</a> some_wibar.widget = naughty.list.notifications { base_layout = wibox.widget { spacing = beautiful.notification_spacing, layout = wibox.layout.fixed.horizontal }, } for margin = 10, 20, 5 do naughty.notification { title = "A notification", margin = margin, border_width = 1, border_color = "#ff0000", } endConstraints:
Default value : beautiful.notification_marginType description: number : A single value for all sides. table: : A different value for all sides. top (number) bottom (number) left (number) right (number) Unit : pixel Negative allowed : false See also:
shape Widget shape. object properties
Click to display more Emit signals:
property::marginWhen the margin value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuemargin The new value affected to the property.
- 🔗 preset table or nil · 1 signal
-
Table with any of the above parameters.
args will override ones defined
in the preset.
Constraints:
Default value : nil
Click to display more Emit signals:
property::presetWhen the preset value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuepreset The new value affected to the property.
- 🔗 callback function or nil · 1 signal
-
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.
Constraints:
Default value : nilFunction prototype: Parameters: legacy_data (table) appname (string) replaces_id (number) app_icon (string) title (string) message (string) actions (table) hints (table) expire (number) Return : The function returns nothing.
Click to display more Emit signals:
property::callbackWhen the callback value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuecallback The new value affected to the property.
- 🔗 actions table · 1 signal
-
A table containing strings that represents actions to buttons.
The table key (a number) is used by DBus to set map the action.
Constraints:
Default value : {}Table content : A list of naughty.action objects.
Click to display more Emit signals:
property::actionsWhen the actions value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueactions The new value affected to the property.
- 🔗 ignore boolean · 1 signal
-
Ignore this notification, do not display.
Note that this property has to be set in a preset or in a
request::presethandler.Constraints:
Default value : falseValid values : trueorfalse.
Click to display more Emit signals:
property::ignoreWhen the ignore value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueignore The new value affected to the property.
- 🔗 suspended boolean · 1 signal
-
Tell if the notification is currently suspended (read only).
This is always equal to naughty.suspended
Constraints:
Default value : falseValid values : trueorfalse.See also:
naughty.suspended The global suspension state. (naughty) object properties
Click to display more Emit signals:
property::suspendedWhen the suspended value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuesuspended The new value affected to the property.
- 🔗 is_expired boolean · 1 signal
-
If the notification is expired.
Constraints:
Default value : This becomes trueeither then:destroy()is called or if thetimeoutexpires.Valid values : trueorfalse.See also:
naughty.expiration_paused Do not allow notifications to auto-expire. (naughty) object properties
Click to display more Emit signals:
property::is_expiredWhen the is_expired value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueis_expired The new value affected to the property.
- 🔗 auto_reset_timeout boolean · 1 signal
-
If the timeout needs to be reset when a property changes.
By default it fallsback to naughty.auto_reset_timeout, which itself is true by default.
Constraints:
Default value : trueValid values : trueorfalse.
Click to display more Emit signals:
property::auto_reset_timeoutWhen the auto_reset_timeout value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueauto_reset_timeout The new value affected to the property.
- 🔗 clients table
-
A list of clients associated with this notification.
When used with DBus notifications, this returns all clients sharing the PID of the notification sender. Note that this is highly unreliable. Applications that use a different process to send the notification or applications (and scripts) calling the
notify-sendcommand wont have any client.Constraints:
Default value : {}Table content : A list of client objects. - 🔗 max_width number or nil · 1 signal · 1 theme variable
-
The maximum popup width.
Some notifications have overlong message, cap them to this width. Note that this is ignored by naughty.list.notifications because it delegate this decision to the layout.
Constraints:
Default value : 500Type description: nil : Fallback to the current value of beautiful.notification_max_width.Unit : pixel Negative allowed : false
Click to display more Emit signals:
property::max_widthWhen the max_width value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuemax_width The new value affected to the property.
Consumed theme variables:
Theme variable Usage beautiful.notification_max_widthFallback when max_width isn't set. - 🔗 app_name string or nil · 1 signal
-
The application name specified by the notification.
This can be anything. It is usually less relevant than the clients property, but can sometime be specified for remote or headless notifications. In these case, it helps to triage and detect the notification from the rules.
Constraints:
Default value : nil
Click to display more Emit signals:
property::app_nameWhen the app_name value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valueapp_name The new value affected to the property.
- 🔗 widget_template template or nil · 1 signal
-
The widget template used to represent the notification.
Some notifications, such as chat messages or music applications are better off with a specialized notification widget.
Constraints:
Default value : nilType description: table : A table containing a widget tree definition. WARNING: This is really a table and NOT a widget object. Use the widget = come.class.hereto define the topmost class rather than construct an instance.
Click to display more Emit signals:
property::widget_templateWhen the widget_template value changes.selfnaughty.notification The object which changed (useful when connecting many object to the same callback).new_valuewidget_template The new value affected to the property.
Deprecated object properties
- 🔗 text string
-
Text of the notification.
This exists only for the pre-AwesomeWM v4.4 new notification implementation. Please always use title.
See also:
title Title of the notification. object properties - 🔗 run function
-
Function to run on left click.
Use the signals rather than this.
See also:
destroyed Emitted when the notification is destroyed. signals - 🔗 destroy function
-
Function to run when notification is destroyed.
Use the signals rather than this.
See also:
destroyed Emitted when the notification is destroyed. signals
Object methods
- 🔗 :destroy (reason, keep_visible) -> boolean · 1 signal
-
Destroy notification by notification object.
Parameters:
Name Type(s) Description Default value reason string One of the reasons from notification_closed_reasonNot applicable keep_visible Optional boolean If true, keep the notification visible falseReturns:
-
boolean
True if the popup was successfully destroyed, false otherwise.
See also:
naughty.notification_closed_reason The reason why a notification is to be closed. (naughty) tables
Click to display more Emit signals:
- destroyed
reasonintegerThe reason.keep_visiblebooleanIf the notification should be kept.
- 🔗 :reset_timeout (new_timeout)
-
Set new notification timeout.
Parameters:
Name Type(s) Description new_timeout number Time in seconds after which notification disappears. - 🔗 :append_actions (new_actions)
-
Add more actions to the notification.
Parameters:
Name Type(s) Description new_actions table - 🔗 :grant (permission, context)
-
Grant a permission for a notification.
Parameters:
Name Type(s) Description permission string The permission name (just the name, no request::).context string The reason why this permission is requested. See also:
awful.permissions Default implementation of the various requests handers. module - 🔗 :deny (permission, context)
-
Deny a permission for a notification
Parameters:
Name Type(s) Description permission string The permission name (just the name, no request::).context string The reason why this permission is requested. See also:
awful.permissions Default implementation of the various requests handers. module - 🔗 :emit_signal (name, ...) · Inherited from gears.object
-
Emit a signal.
Parameters:
Name Type(s) Description name string The name of the signal. ... Extra arguments for the callback functions. Each connected function receives the object as first argument and then any extra arguments that are given to emit_signal(). - 🔗 :connect_signal (name, func) · Inherited from gears.object
-
Connect to a signal.
Parameters:
Name Type(s) Description name string The name of the signal. func function The callback to call when the signal is emitted. - 🔗 :weak_connect_signal (name, func) · Inherited from gears.object
-
Connect to a signal weakly.
This allows the callback function to be garbage collected and automatically disconnects the signal when that happens.
Warning: Only use this function if you really, really, really know what you are doing.
Parameters:
Name Type(s) Description name string The name of the signal. func function The callback to call when the signal is emitted.
Signals
- 🔗 destroyed
-
Emitted when the notification is destroyed.
Arguments:
Name Type(s) Description reason number Why it was destroyed keep_visible boolean If it was kept visible. See also:
naughty.notification_closed_reason The reason why a notification is to be closed. (naughty) tables
Theme variables
- 🔗 beautiful.notification_font string or lgi.Pango.FontDescription
-
Notifications font.
Click to display more Used by:
- naughty.notification Create a notification.
- naughty.notification Create a notification.
- font Notification font.
- font Notification font.
- naughty.widget.message Create a new naughty.widget.message.
- naughty.widget.title Create a new naughty.widget.title.
- 🔗 beautiful.notification_bg color
-
Notifications background color.
Click to display more Used by:
- 🔗 beautiful.notification_fg color
-
Notifications foreground color.
Click to display more Used by:
- naughty.notification Create a notification.
- naughty.notification Create a notification.
- naughty.widget.message Create a new naughty.widget.message.
- naughty.widget.title Create a new naughty.widget.title.
- fg Foreground color.
- 🔗 beautiful.notification_border_width int
-
Notifications border width.
Click to display more Used by:
- naughty.notification Create a notification.
- naughty.notification Create a notification.
- border_width Border width.
- border_width Border width.
naughty.container.backgroundCreate a new naughty.container.background.- border_width Border width.
- 🔗 beautiful.notification_border_color color
-
Notifications border color.
Click to display more Used by:
- naughty.notification Create a notification.
- naughty.notification Create a notification.
- border_color Border color.
- border_color Border color.
naughty.container.backgroundCreate a new naughty.container.background.
- 🔗 beautiful.notification_shape gears.shape
-
Notifications shape.
See also:
gears.shape Module dedicated to gather common shape painters. module
Click to display more Used by:
- naughty.notification Create a notification.
- naughty.notification Create a notification.
- shape Widget shape.
- shape Widget shape.
naughty.container.backgroundCreate a new naughty.container.background.
- 🔗 beautiful.notification_opacity int
-
Notifications opacity.
Click to display more Used by:
- naughty.notification Create a notification.
- naughty.notification Create a notification.
- opacity Widget opacity.
- opacity Widget opacity.
- 🔗 beautiful.notification_margin int
-
The margins inside of the notification widget (or popup).
Click to display more Used by:
- naughty.notification Create a notification.
- naughty.notification Create a notification.
- 🔗 beautiful.notification_width int
-
Notifications width.
Click to display more Used by:
- naughty.notification Create a notification.
- naughty.notification Create a notification.
- width Popup width.
- 🔗 beautiful.notification_height int
-
Notifications height.
Click to display more Used by:
- naughty.notification Create a notification.
- naughty.notification Create a notification.
- height Popup height.
- 🔗 beautiful.notification_spacing number
-
The spacing between the notifications.
See also:
gears.surface Utilities to integrate and manipulate Cairo drawing surfaces. module
Click to display more Used by:
base_layoutA `wibox.layout` to be used to place the entries.