Docs: Work on naughty

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
This commit is contained in:
Ignas Anikevicius (gns_ank) 2014-05-20 22:39:31 +01:00 committed by Daniel Hahler
parent 7f8a0787b8
commit ed0bf91122
1 changed files with 32 additions and 20 deletions

View File

@ -4,6 +4,7 @@
-- @author koniu &lt;gkusnierz@gmail.com&gt; -- @author koniu &lt;gkusnierz@gmail.com&gt;
-- @copyright 2008 koniu -- @copyright 2008 koniu
-- @release @AWESOME_VERSION@ -- @release @AWESOME_VERSION@
-- @module naughty
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
-- Package environment -- Package environment
@ -31,32 +32,40 @@ 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
naughty.config = {} naughty.config = {}
--- Space between popups and edge of the workarea. Default: 4 --- Space between popups and edge of the workarea.
-- Default: 4
-- @table naughty.config.padding
naughty.config.padding = 4 naughty.config.padding = 4
--- Spacing between popups. Default: `1` --- Spacing between popups. Default: `1`
-- @table naughty.config.spacing
naughty.config.spacing = 1 naughty.config.spacing = 1
--- List of directories that will be checked by getIcon() --- List of directories that will be checked by getIcon().
-- Default: `{ "/usr/share/pixmaps/", }` -- Default: `{ "/usr/share/pixmaps/", }`
-- @table naughty.config.icon_dirs
naughty.config.icon_dirs = { "/usr/share/pixmaps/", } naughty.config.icon_dirs = { "/usr/share/pixmaps/", }
--- List of formats that will be checked by getIcon() --- List of formats that will be checked by getIcon().
-- Default: `{ "png", "gif" }` -- Default: `{ "png", "gif" }`
-- @table naughty.config.icon_formats
naughty.config.icon_formats = { "png", "gif" } naughty.config.icon_formats = { "png", "gif" }
--- Callback used to modify or reject notifications. --- Callback used to modify or reject notifications.
-- Default: `nil` -- Default: `nil`
-- Example: -- @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 naughty.config.notify_callback = nil
--- Notification Presets - a table containing presets for different purposes --- Notification Presets - a table containing presets for different purposes.
-- Preset is a table of any parameters available to notify(), overriding default -- Preset is a table of any parameters available to notify(), overriding default
-- values (`naughty.config.defaults`) -- values (`naughty.config.defaults`)
-- You have to pass a reference of a preset in your notify() call to use the preset -- 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 -- The presets "low", "normal" and "critical" are used for notifications over DBUS
--
-- @field low The preset for notifications with low urgency level -- @field low The preset for notifications with low urgency level
-- @field normal The default preset for every notification without a preset that will also be used for normal urgency level -- @field normal The default preset for every notification without a preset that will also be used for normal urgency level
-- @field critical The preset for notifications with a critical urgency level -- @field critical The preset for notifications with a critical urgency level
@ -75,8 +84,10 @@ naughty.config.presets = {
--- Default values for the params to notify(). --- Default values for the params to notify().
-- These can optionally be overridden by specifying a preset -- These can optionally be overridden by specifying a preset
--
-- @see naughty.config.presets -- @see naughty.config.presets
-- @see naughty.notify -- @see naughty.notify
-- @table naughty.config.defaults
naughty.config.defaults = { naughty.config.defaults = {
timeout = 5, timeout = 5,
text = "", text = "",
@ -102,14 +113,15 @@ local counter = 1
-- True if notifying is suspended -- True if notifying is suspended
local suspended = false local suspended = false
--- Index of notifications per screen and position. See config table for valid --- Index of notifications per screen and position.
-- 'position' values. Each element is a table consisting of: -- See config table for valid 'position' values.
-- Each element is a table consisting of:
-- @field box Wibox object containing the popup -- @field box Wibox object containing the popup
-- @field height Popup height -- @field height Popup height
-- @field width Popup width -- @field width Popup width
-- @field die Function to be executed on timeout -- @field die Function to be executed on timeout
-- @field id Unique notification id based on a counter -- @field id Unique notification id based on a counter
-- @table naughty.notifications -- @table notifications
naughty.notifications = { suspended = { } } naughty.notifications = { suspended = { } }
for s = 1, capi.screen.count() do for s = 1, capi.screen.count() do
naughty.notifications[s] = { naughty.notifications[s] = {
@ -258,19 +270,19 @@ end
-- Default: nil -- Default: nil
-- @tparam int args.screen Target screen for the notification. Default: 1 -- @tparam int args.screen Target screen for the notification. Default: 1
-- @tparam string args.position Corner of the workarea displaying the popups. -- @tparam string args.position Corner of the workarea displaying the popups.
-- Values: "top_right" (default), "top_left", "bottom_left", "bottom_right", -- Values: `"top_right"` (default), `"top_left"`, `"bottom_left"`,
-- "top_middle", "bottom_middle". -- `"bottom_right"`, `"top_middle"`, `"bottom_middle"`.
-- @tparam bool args.ontop Boolean forcing popups to display on top. Default: true -- @tparam bool args.ontop Boolean forcing popups to display on top. Default: true
-- @tparam int args.height Popup height. Default: nil (auto) -- @tparam int args.height Popup height. Default: nil (auto)
-- @tparam int args.width Popup width. Default: nil (auto) -- @tparam int args.width Popup width. Default: nil (auto)
-- @tparam string args.font Notification font. Default: beautiful.font or awesome.font -- @tparam string args.font Notification font. Default: beautiful.font or awesome.font
-- @tparam string args.icon Path to icon. Default: nil -- @tparam string args.icon Path to icon. Default: nil
-- @tparam int args.icon_size Desired icon size in px. Default: nil -- @tparam int args.icon_size Desired icon size in px. Default: nil
-- @tparam string args.fg Foreground color. Default: beautiful.fg_focus or '#ffffff' -- @tparam string args.fg Foreground color. Default: `beautiful.fg_focus` or `'#ffffff'`
-- @tparam string args.bg Background color. Default: beautiful.bg_focus or '#535d6c' -- @tparam string args.bg Background color. Default: `beautiful.bg_focus` or `'#535d6c'`
-- @tparam int args.border_width Border width. Default: 1 -- @tparam int args.border_width Border width. Default: 1
-- @tparam string args.border_color Border color. -- @tparam 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.
-- @tparam table args.preset Table with any of the above parameters. -- @tparam table args.preset Table with any of the above parameters.