Docs: Naughty - mostly done
Reorganise the config table, so that we have a single table and the fields are nested. Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
This commit is contained in:
parent
734cc2f59c
commit
4b94f05799
|
@ -32,44 +32,56 @@ local tins = table.insert
|
||||||
local naughty = {}
|
local naughty = {}
|
||||||
|
|
||||||
--- Naughty configuration - a table containing common popup settings.
|
--- Naughty configuration - a table containing common popup settings.
|
||||||
|
--
|
||||||
-- @table naughty.config
|
-- @table naughty.config
|
||||||
naughty.config = {}
|
-- @field padding Space between popups and edge of the workarea.
|
||||||
--- Space between popups and edge of the workarea.
|
-- Default: `4`
|
||||||
-- Default: 4
|
-- @field spacing Spacing between popups.
|
||||||
-- @table naughty.config.padding
|
-- Default: `1`
|
||||||
naughty.config.padding = 4
|
-- @field icon_dirs List of directories that will be checked by `getIcon()`.
|
||||||
--- Spacing between popups. Default: `1`
|
|
||||||
-- @table naughty.config.spacing
|
|
||||||
naughty.config.spacing = 1
|
|
||||||
--- List of directories that will be checked by getIcon().
|
|
||||||
-- Default: `{ "/usr/share/pixmaps/", }`
|
-- Default: `{ "/usr/share/pixmaps/", }`
|
||||||
-- @table naughty.config.icon_dirs
|
-- @field icon_formats List of formats that will be checked by `getIcon()`.
|
||||||
naughty.config.icon_dirs = { "/usr/share/pixmaps/", }
|
|
||||||
--- List of formats that will be checked by getIcon().
|
|
||||||
-- Default: `{ "png", "gif" }`
|
-- Default: `{ "png", "gif" }`
|
||||||
-- @table naughty.config.icon_formats
|
-- @field notify_callback Callback used to modify or reject notifications.
|
||||||
naughty.config.icon_formats = { "png", "gif" }
|
|
||||||
--- Callback used to modify or reject notifications.
|
|
||||||
-- Default: `nil`
|
-- Default: `nil`
|
||||||
-- @usage
|
|
||||||
-- naughty.config.notify_callback = function(args)
|
-- naughty.config.notify_callback = function(args)
|
||||||
-- args.text = 'prefix: ' .. args.text
|
-- args.text = 'prefix: ' .. args.text
|
||||||
-- return args
|
-- return args
|
||||||
-- end
|
-- end
|
||||||
-- @table naughty.config.notify_callback
|
|
||||||
naughty.config.notify_callback = nil
|
|
||||||
|
|
||||||
|
|
||||||
--- Notification Presets - a table containing presets for different purposes.
|
|
||||||
-- Preset is a table of any parameters available to notify(), overriding default
|
|
||||||
-- values (`naughty.config.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
|
|
||||||
--
|
--
|
||||||
-- @field low The preset for notifications with low urgency level
|
-- @field presets Notification Presets - a table containing presets for
|
||||||
-- @field normal The default preset for every notification without a preset that will also be used for normal urgency level
|
-- different purposes. Preset is a table of any parameters available to
|
||||||
-- @field critical The preset for notifications with a critical urgency level
|
-- `notify()`, overriding default values (`naughty.config.defaults`) You have
|
||||||
-- @table naughty.config.presets
|
-- 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.
|
||||||
|
--
|
||||||
|
-- @field presets.low The preset for notifications with low urgency level.
|
||||||
|
-- @field presets.normal The default preset for every notification without a
|
||||||
|
-- preset that will also be used for normal urgency level.
|
||||||
|
-- @field presets.critical The preset for notifications with a critical urgency
|
||||||
|
-- level.
|
||||||
|
--
|
||||||
|
-- @field defaults Default values for the params to `notify()`.
|
||||||
|
-- These can optionally be overridden by specifying a preset.
|
||||||
|
--
|
||||||
|
-- @field 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
|
||||||
|
--
|
||||||
|
-- @field mapping.1 low urgency
|
||||||
|
-- @field mapping.2 normal urgency
|
||||||
|
-- @field mapping.3 critical urgency
|
||||||
|
--
|
||||||
|
naughty.config = {
|
||||||
|
padding = 4,
|
||||||
|
spacing = 1,
|
||||||
|
icon_dirs = { "/usr/share/pixmaps/", },
|
||||||
|
icon_formats = { "png", "gif" },
|
||||||
|
notify_callback = nil,
|
||||||
|
}
|
||||||
|
|
||||||
naughty.config.presets = {
|
naughty.config.presets = {
|
||||||
low = {
|
low = {
|
||||||
timeout = 5
|
timeout = 5
|
||||||
|
@ -82,12 +94,6 @@ naughty.config.presets = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Default values for the params to notify().
|
|
||||||
-- These can optionally be overridden by specifying a preset
|
|
||||||
--
|
|
||||||
-- @see naughty.config.presets
|
|
||||||
-- @see naughty.notify
|
|
||||||
-- @table naughty.config.defaults
|
|
||||||
naughty.config.defaults = {
|
naughty.config.defaults = {
|
||||||
timeout = 5,
|
timeout = 5,
|
||||||
text = "",
|
text = "",
|
||||||
|
@ -260,28 +266,42 @@ function naughty.getById(id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Create notification. args is a dictionary of (optional) arguments.
|
--- Create notification.
|
||||||
-- @tparam table args The argument table containing any of the arguments bellow.
|
--
|
||||||
-- @tparam string args.text Text of the notification. Default: ''
|
-- @tab args The argument table containing any of the arguments bellow.
|
||||||
-- @tparam string args.title Title of the notification. Default: nil
|
-- @string args.text Text of the notification.
|
||||||
-- @tparam int args.timeout Time in seconds after which popup expires.
|
-- Default: ''
|
||||||
-- Set 0 for no timeout. Default: 5
|
-- @string args.title Title of the notification.
|
||||||
-- @tparam int args.hover_timeout Delay in seconds after which hovered popup disappears.
|
|
||||||
-- Default: nil
|
-- Default: nil
|
||||||
-- @tparam int args.screen Target screen for the notification. Default: 1
|
-- @int args.timeout Time in seconds after which popup expires.
|
||||||
-- @tparam string args.position Corner of the workarea displaying the popups.
|
-- Set 0 for no timeout.
|
||||||
|
-- Default: 5
|
||||||
|
-- @int args.hover_timeout Delay in seconds after which hovered popup disappears.
|
||||||
|
-- Default: nil
|
||||||
|
-- @int args.screen Target screen for the notification.
|
||||||
|
-- Default: 1
|
||||||
|
-- @string args.position Corner of the workarea displaying the popups.
|
||||||
-- Values: `"top_right"` (default), `"top_left"`, `"bottom_left"`,
|
-- Values: `"top_right"` (default), `"top_left"`, `"bottom_left"`,
|
||||||
-- `"bottom_right"`, `"top_middle"`, `"bottom_middle"`.
|
-- `"bottom_right"`, `"top_middle"`, `"bottom_middle"`.
|
||||||
-- @tparam bool args.ontop Boolean forcing popups to display on top. Default: true
|
-- @bool args.ontop Boolean forcing popups to display on top.
|
||||||
-- @tparam int args.height Popup height. Default: nil (auto)
|
-- Default: true
|
||||||
-- @tparam int args.width Popup width. Default: nil (auto)
|
-- @int args.height Popup height.
|
||||||
-- @tparam string args.font Notification font. Default: beautiful.font or awesome.font
|
-- Default: nil (auto)
|
||||||
-- @tparam string args.icon Path to icon. Default: nil
|
-- @int args.width Popup width.
|
||||||
-- @tparam int args.icon_size Desired icon size in px. Default: nil
|
-- Default: nil (auto)
|
||||||
-- @tparam string args.fg Foreground color. Default: `beautiful.fg_focus` or `'#ffffff'`
|
-- @string args.font Notification font.
|
||||||
-- @tparam string args.bg Background color. Default: `beautiful.bg_focus` or `'#535d6c'`
|
-- Default: beautiful.font or awesome.font
|
||||||
-- @tparam int args.border_width Border width. Default: 1
|
-- @string args.icon Path to icon.
|
||||||
-- @tparam string args.border_color Border color.
|
-- Default: nil
|
||||||
|
-- @int args.icon_size Desired icon size in px.
|
||||||
|
-- Default: nil
|
||||||
|
-- @string args.fg Foreground color.
|
||||||
|
-- Default: `beautiful.fg_focus` or `'#ffffff'`
|
||||||
|
-- @string args.bg Background color.
|
||||||
|
-- Default: `beautiful.bg_focus` or `'#535d6c'`
|
||||||
|
-- @int args.border_width Border width.
|
||||||
|
-- Default: 1
|
||||||
|
-- @string args.border_color Border color.
|
||||||
-- Default: `beautiful.border_focus` or `'#535d6c'`
|
-- Default: `beautiful.border_focus` or `'#535d6c'`
|
||||||
-- @tparam func args.run Function to run on left click. Default: nil
|
-- @tparam func args.run Function to run on left click. Default: nil
|
||||||
-- @tparam func args.destroy Function to run when notification is destroyed. Default: nil.
|
-- @tparam func args.destroy Function to run when notification is destroyed. Default: nil.
|
||||||
|
|
Loading…
Reference in New Issue