Lots of random documentation fixes

This is mostly about mis-named parameters, but also other small things.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2012-11-19 14:09:10 +01:00
parent 5ea174782d
commit 96e03cb45d
15 changed files with 155 additions and 159 deletions

View File

@ -30,7 +30,7 @@ local ignore_modifiers = { "Lock", "Mod2" }
-- ignored by default by this function), creating key binding with this function -- ignored by default by this function), creating key binding with this function
-- will return 2 key objects: one with CapsLock on, and the other one with -- will return 2 key objects: one with CapsLock on, and the other one with
-- CapsLock off. -- CapsLock off.
-- @see capi.key -- @see key
-- @return A table with one or several key objects. -- @return A table with one or several key objects.
function key.new(mod, _key, press, release) function key.new(mod, _key, press, release)
local ret = {} local ret = {}
@ -49,7 +49,7 @@ function key.new(mod, _key, press, release)
end end
--- Compare a key object with modifiers and key. --- Compare a key object with modifiers and key.
-- @param key The key object. -- @param _key The key object.
-- @param pressed_mod The modifiers to compare with. -- @param pressed_mod The modifiers to compare with.
-- @param pressed_key The key to compare with. -- @param pressed_key The key to compare with.
function key.match(_key, pressed_mod, pressed_key) function key.match(_key, pressed_mod, pressed_key)

View File

@ -57,7 +57,8 @@ function layout.inc(layouts, i)
end end
--- Set the layout function of the current tag. --- Set the layout function of the current tag.
-- @param layout Layout name. -- @param _layout Layout name.
-- @param t The tag to modify, if null tag.selected() is used.
function layout.set(_layout, t) function layout.set(_layout, t)
t = t or tag.selected() t = t or tag.selected()
tag.setproperty(t, "layout", _layout) tag.setproperty(t, "layout", _layout)

View File

@ -216,9 +216,9 @@ local function grabber(_menu, mod, key, event)
end end
function menu.exec(_menu, num, opts) function menu:exec(num, opts)
opts = opts or {} opts = opts or {}
local item = _menu.items[num] local item = self.items[num]
if not item then return end if not item then return end
local cmd = item.cmd local cmd = item.cmd
if type(cmd) == "table" then if type(cmd) == "table" then
@ -229,41 +229,41 @@ function menu.exec(_menu, num, opts)
end end
return return
end end
if not _menu.child[num] then if not self.child[num] then
_menu.child[num] = menu.new(cmd, _menu) self.child[num] = menu.new(cmd, self)
end end
local can_invoke_action = opts.exec and local can_invoke_action = opts.exec and
action and type(action) == "function" and action and type(action) == "function" and
(not opts.mouse or (opts.mouse and (_menu.auto_expand or (not opts.mouse or (opts.mouse and (self.auto_expand or
(_menu.active_child == _menu.child[num] and (self.active_child == self.child[num] and
_menu.active_child.wibox.visible)))) self.active_child.wibox.visible))))
if can_invoke_action then if can_invoke_action then
local visible = action(_menu.child[num], item) local visible = action(self.child[num], item)
if not visible then if not visible then
menu.get_root(_menu):hide() menu.get_root(self):hide()
return return
else else
_menu.child[num]:update() self.child[num]:update()
end end
end end
if _menu.active_child and _menu.active_child ~= _menu.child[num] then if self.active_child and self.active_child ~= self.child[num] then
_menu.active_child:hide() self.active_child:hide()
end end
_menu.active_child = _menu.child[num] self.active_child = self.child[num]
if not _menu.active_child.visible then if not self.active_child.visible then
_menu.active_child:show() self.active_child:show()
end end
elseif type(cmd) == "string" then elseif type(cmd) == "string" then
menu.get_root(_menu):hide() menu.get_root(self):hide()
util.spawn(cmd) util.spawn(cmd)
elseif type(cmd) == "function" then elseif type(cmd) == "function" then
local visible, action = cmd(item, _menu) local visible, action = cmd(item, self)
if not visible then if not visible then
menu.get_root(_menu):hide() menu.get_root(self):hide()
else else
_menu:update() self:update()
if _menu.items[num] then if self.items[num] then
_menu:item_enter(num, opts) self:item_enter(num, opts)
end end
end end
if action and type(action) == "function" then if action and type(action) == "function" then
@ -272,35 +272,35 @@ function menu.exec(_menu, num, opts)
end end
end end
function menu.item_enter(_menu, num, opts) function menu:item_enter(num, opts)
opts = opts or {} opts = opts or {}
local item = _menu.items[num] local item = self.items[num]
if num == nil or _menu.sel == num or not item then if num == nil or self.sel == num or not item then
return return
elseif _menu.sel then elseif self.sel then
_menu:item_leave(_menu.sel) self:item_leave(self.sel)
end end
--print("sel", num, menu.sel, item.theme.bg_focus) --print("sel", num, menu.sel, item.theme.bg_focus)
item._background:set_fg(item.theme.fg_focus) item._background:set_fg(item.theme.fg_focus)
item._background:set_bg(item.theme.bg_focus) item._background:set_bg(item.theme.bg_focus)
_menu.sel = num self.sel = num
if _menu.auto_expand and opts.hover then if self.auto_expand and opts.hover then
if _menu.active_child then if self.active_child then
_menu.active_child:hide() self.active_child:hide()
_menu.active_child = nil self.active_child = nil
end end
if type(item.cmd) == "table" then if type(item.cmd) == "table" then
_menu:exec(num, opts) self:exec(num, opts)
end end
end end
end end
function menu.item_leave(_menu, num) function menu:item_leave(num)
--print("leave", num) --print("leave", num)
local item = _menu.items[num] local item = self.items[num]
if item then if item then
item._background:set_fg(item.theme.fg_normal) item._background:set_fg(item.theme.fg_normal)
item._background:set_bg(item.theme.bg_normal) item._background:set_bg(item.theme.bg_normal)
@ -309,77 +309,72 @@ end
--- Show a menu. --- Show a menu.
-- @param _menu The menu to show.
-- @param args.coords Menu position defaulting to mouse.coords() -- @param args.coords Menu position defaulting to mouse.coords()
function menu.show(_menu, args) function menu:show(args)
args = args or {} args = args or {}
local coords = args.coords or nil local coords = args.coords or nil
local screen_index = capi.mouse.screen local screen_index = capi.mouse.screen
if not set_size(_menu) then return end if not set_size(self) then return end
set_coords(_menu, screen_index, coords) set_coords(self, screen_index, coords)
keygrabber.run(_menu._keygrabber) keygrabber.run(self._keygrabber)
_menu.wibox.visible = true self.wibox.visible = true
end end
--- Hide a menu popup. --- Hide a menu popup.
-- @param _menu The menu to hide. function menu:hide()
function menu.hide(_menu)
-- Remove items from screen -- Remove items from screen
for i = 1, #_menu.items do for i = 1, #self.items do
_menu:item_leave(i) self:item_leave(i)
end end
if _menu.active_child then if self.active_child then
_menu.active_child:hide() self.active_child:hide()
_menu.active_child = nil self.active_child = nil
end end
_menu.sel = nil self.sel = nil
keygrabber.stop(_menu._keygrabber) keygrabber.stop(self._keygrabber)
_menu.wibox.visible = false self.wibox.visible = false
end end
--- Toggle menu visibility. --- Toggle menu visibility.
-- @param _menu The menu to show if it's hidden, or to hide if it's shown. -- @param _menu The menu to show if it's hidden, or to hide if it's shown.
-- @param args.coords Menu position {x,y} -- @param args.coords Menu position {x,y}
function menu.toggle(_menu, args) function menu:toggle(args)
if _menu.wibox.visible then if self.wibox.visible then
_menu:hide() self:hide()
else else
_menu:show(args) self:show(args)
end end
end end
--- Update menu content --- Update menu content
-- @param _menu The mnenu to update. function menu:update()
function menu.update(_menu) if self.wibox.visible then
if _menu.wibox.visible then self:show({ coords = { x = self.x, y = self.y } })
_menu:show({ coords = { x = _menu.x, y = _menu.y } })
end end
end end
--- Get the elder parent so for example when you kill --- Get the elder parent so for example when you kill
-- it, it will destroy the whole family. -- it, it will destroy the whole family.
-- @param _menu The sub menu of the menu family. function menu:get_root()
function menu.get_root(_menu) return self.parent and menu.get_root(self.parent) or self
return _menu.parent and menu.get_root(_menu.parent) or _menu
end end
--- Add a new menu entry --- Add a new menu entry.
-- @param _menu The parent menu -- args.new (Default: awful.menu.entry) The menu entry constructor.
-- args.theme (Optional) The menu entry theme.
-- args.* params needed for the menu entry constructor.
-- @param args The item params -- @param args The item params
-- @param args.new (Default: awful.menu.entry) The menu entry constructor
-- @param args.theme (Optional) The menu entry theme
-- @param args.* params needed for the menu entry constructor
-- @param index (Optional) the index where the new entry will inserted -- @param index (Optional) the index where the new entry will inserted
function menu.add(_menu, args, index) function menu:add(args, index)
if not args then return end if not args then return end
local theme = load_theme(args.theme or {}, _menu.theme) local theme = load_theme(args.theme or {}, self.theme)
args.theme = theme args.theme = theme
args.new = args.new or menu.entry args.new = args.new or menu.entry
local success, item = pcall(args.new, _menu, args) local success, item = pcall(args.new, self, args)
if not success then if not success then
print("Error while creating menu entry: " .. item) print("Error while creating menu entry: " .. item)
return return
@ -388,7 +383,7 @@ function menu.add(_menu, args, index)
print("Error while checking menu entry: no property widget found.") print("Error while checking menu entry: no property widget found.")
return return
end end
item.parent = _menu item.parent = self
item.theme = item.theme or theme item.theme = item.theme or theme
item.width = item.width or theme.width item.width = item.width or theme.width
item.height = item.height or theme.height item.height = item.height or theme.height
@ -401,29 +396,29 @@ function menu.add(_menu, args, index)
-- Create bindings -- Create bindings
item._background:buttons(util.table.join( item._background:buttons(util.table.join(
button({}, 3, function () _menu:hide() end), button({}, 3, function () self:hide() end),
button({}, 1, function () button({}, 1, function ()
local num = util.table.hasitem(_menu.items, item) local num = util.table.hasitem(self.items, item)
_menu:item_enter(num, { mouse = true }) self:item_enter(num, { mouse = true })
_menu:exec(num, { exec = true, mouse = true }) self:exec(num, { exec = true, mouse = true })
end ))) end )))
item._mouse = function () item._mouse = function ()
local num = util.table.hasitem(_menu.items, item) local num = util.table.hasitem(self.items, item)
_menu:item_enter(num, { hover = true, moue = true }) self:item_enter(num, { hover = true, moue = true })
end end
item.widget:connect_signal("mouse::enter", item._mouse) item.widget:connect_signal("mouse::enter", item._mouse)
if index then if index then
_menu.layout:reset() self.layout:reset()
table.insert(_menu.items, index, item) table.insert(self.items, index, item)
for _, i in ipairs(_menu.items) do for _, i in ipairs(self.items) do
_menu.layout:add(i._background) self.layout:add(i._background)
end end
else else
table.insert(_menu.items, item) table.insert(self.items, item)
_menu.layout:add(item._background) self.layout:add(item._background)
end end
return item return item
end end
@ -431,29 +426,29 @@ end
-- Delete menu entry at given position -- Delete menu entry at given position
-- @param _menu The menu -- @param _menu The menu
-- @param num The position in the table of the menu entry to be deleted; can be also the menu entry itself -- @param num The position in the table of the menu entry to be deleted; can be also the menu entry itself
function menu.delete(_menu, num) function menu:delete(num)
if type(num) == "table" then if type(num) == "table" then
num = util.table.hasitem(_menu.items, num) num = util.table.hasitem(self.items, num)
end end
local item = _menu.items[num] local item = self.items[num]
if not item then return end if not item then return end
item.widget:disconnect_signal("mouse::enter", item._mouse) item.widget:disconnect_signal("mouse::enter", item._mouse)
item.widget.visible = false item.widget.visible = false
table.remove(_menu.items, num) table.remove(self.items, num)
if _menu.sel == num then if self.sel == num then
_menu:item_leave(_menu.sel) self:item_leave(self.sel)
_menu.sel = nil self.sel = nil
end end
_menu.layout:reset() self.layout:reset()
for _, i in ipairs(_menu.items) do for _, i in ipairs(self.items) do
_menu.layout:add(i._background) self.layout:add(i._background)
end end
if _menu.child[num] then if self.child[num] then
_menu.child[num]:hide() self.child[num]:hide()
if _menu.active_child == _menu.child[num] then if self.active_child == self.child[num] then
_menu.active_child = nil self.active_child = nil
end end
table.remove(_menu.child, num) table.remove(self.child, num)
end end
end end
@ -462,8 +457,8 @@ end
--- Build a popup menu with running clients and shows it. --- Build a popup menu with running clients and shows it.
-- @param _menu Menu table, see new() function for more informations -- @param _menu Menu table, see new() function for more informations
-- @return The menu. -- @return The menu.
function menu.clients(_menu, args) -- FIXME crude api function menu:clients(args) -- FIXME crude api
_menu = _menu or {} _menu = self or {}
local cls = capi.client.get() local cls = capi.client.get()
local cls_t = {} local cls_t = {}
for k, c in pairs(cls) do for k, c in pairs(cls) do

View File

@ -129,7 +129,7 @@ end
--- Check if a client match a rule. Multiple clients can be matched --- Check if a client match a rule. Multiple clients can be matched
-- @param c The client. -- @param c The client.
-- @param rules The rule to check. -- @param rule The rule to check.
-- @return True if at least one rule is matched, false otherwise. -- @return True if at least one rule is matched, false otherwise.
function rules.match_any(c, rule) function rules.match_any(c, rule)
if not rule then return false end if not rule then return false end

View File

@ -66,7 +66,7 @@ end
--- Give the focus to a screen, and move pointer, by physical position relative to current screen. --- Give the focus to a screen, and move pointer, by physical position relative to current screen.
-- @param dir The direction, can be either "up", "down", "left" or "right". -- @param dir The direction, can be either "up", "down", "left" or "right".
-- @param screen Screen number. -- @param _screen Screen number.
function screen.focus_bydirection(dir, _screen) function screen.focus_bydirection(dir, _screen)
local sel = _screen or capi.mouse.screen local sel = _screen or capi.mouse.screen
if sel then if sel then
@ -90,7 +90,7 @@ function screen.focus_relative(i)
end end
--- Get or set the screen padding. --- Get or set the screen padding.
-- @param screen The screen object to change the padding on -- @param _screen The screen object to change the padding on
-- @param padding The padding, an table with 'top', 'left', 'right' and/or -- @param padding The padding, an table with 'top', 'left', 'right' and/or
-- 'bottom'. Can be nil if you only want to retrieve padding -- 'bottom'. Can be nil if you only want to retrieve padding
function screen.padding(_screen, padding) function screen.padding(_screen, padding)

View File

@ -35,6 +35,8 @@ tag.history.limit = 20
--- Move a tag to an absolute position in the screen[]:tags() table. --- Move a tag to an absolute position in the screen[]:tags() table.
-- @param new_index Integer absolute position in the table to insert. -- @param new_index Integer absolute position in the table to insert.
-- @param target_tag The tag that should be moved. If null, the currently
-- selected tag is used.
function tag.move(new_index, target_tag) function tag.move(new_index, target_tag)
local target_tag = target_tag or tag.selected() local target_tag = target_tag or tag.selected()
local scr = tag.getscreen(target_tag) local scr = tag.getscreen(target_tag)
@ -97,7 +99,7 @@ end
--- Find a suitable fallback tag. --- Find a suitable fallback tag.
-- @param screen The screen number to look for a tag on. [mouse.screen] -- @param screen The screen number to look for a tag on. [mouse.screen]
-- @param target A table of tags we consider unacceptable. [selectedlist(scr)] -- @param invalids A table of tags we consider unacceptable. [selectedlist(scr)]
function tag.find_fallback(screen, invalids) function tag.find_fallback(screen, invalids)
local scr = screen or capi.mouse.screen local scr = screen or capi.mouse.screen
local t = invalids or tag.selectedlist(scr) local t = invalids or tag.selectedlist(scr)
@ -282,6 +284,7 @@ end
--- Set master width factor. --- Set master width factor.
-- @param mwfact Master width factor. -- @param mwfact Master width factor.
-- @param t The tag to modify, if null tag.selected() is used.
function tag.setmwfact(mwfact, t) function tag.setmwfact(mwfact, t)
local t = t or tag.selected() local t = t or tag.selected()
if mwfact >= 0 and mwfact <= 1 then if mwfact >= 0 and mwfact <= 1 then
@ -291,6 +294,7 @@ end
--- Increase master width factor. --- Increase master width factor.
-- @param add Value to add to master width factor. -- @param add Value to add to master width factor.
-- @param t The tag to modify, if null tag.selected() is used.
function tag.incmwfact(add, t) function tag.incmwfact(add, t)
tag.setmwfact(tag.getmwfact(t) + add, t) tag.setmwfact(tag.getmwfact(t) + add, t)
end end
@ -321,6 +325,7 @@ end
--- Increase the number of master windows. --- Increase the number of master windows.
-- @param add Value to add to number of master windows. -- @param add Value to add to number of master windows.
-- @param t The tag to modify, if null tag.selected() is used.
function tag.incnmaster(add, t) function tag.incnmaster(add, t)
tag.setnmaster(tag.getnmaster(t) + add, t) tag.setnmaster(tag.getnmaster(t) + add, t)
end end
@ -328,14 +333,14 @@ end
--- Set the tag icon --- Set the tag icon
-- @param icon the icon to set, either path or image object -- @param icon the icon to set, either path or image object
-- @param tag the tag -- @param _tag the tag
function tag.seticon(icon, _tag) function tag.seticon(icon, _tag)
local _tag = _tag or tag.selected() local _tag = _tag or tag.selected()
tag.setproperty(_tag, "icon", icon) tag.setproperty(_tag, "icon", icon)
end end
--- Get the tag icon --- Get the tag icon
-- @param t the tag -- @param _tag the tag
function tag.geticon(_tag) function tag.geticon(_tag)
local _tag = _tag or tag.selected() local _tag = _tag or tag.selected()
return tag.getproperty(_tag, "icon") return tag.getproperty(_tag, "icon")
@ -343,6 +348,7 @@ end
--- Set number of column windows. --- Set number of column windows.
-- @param ncol The number of column. -- @param ncol The number of column.
-- @param t The tag to modify, if null tag.selected() is used.
function tag.setncol(ncol, t) function tag.setncol(ncol, t)
local t = t or tag.selected() local t = t or tag.selected()
if ncol >= 1 then if ncol >= 1 then
@ -359,6 +365,7 @@ end
--- Increase number of column windows. --- Increase number of column windows.
-- @param add Value to add to number of column windows. -- @param add Value to add to number of column windows.
-- @param t The tag to modify, if null tag.selected() is used.
function tag.incncol(add, t) function tag.incncol(add, t)
tag.setncol(tag.getncol(t) + add, t) tag.setncol(tag.getncol(t) + add, t)
end end
@ -468,7 +475,7 @@ function tag.getdata(_tag)
end end
--- Get a tag property. --- Get a tag property.
-- @param tag The tag. -- @param _tag The tag.
-- @param prop The property name. -- @param prop The property name.
-- @return The property. -- @return The property.
function tag.getproperty(_tag, prop) function tag.getproperty(_tag, prop)
@ -480,7 +487,7 @@ end
--- Set a tag property. --- Set a tag property.
-- This properties are internal to awful. Some are used to draw taglist, or to -- This properties are internal to awful. Some are used to draw taglist, or to
-- handle layout, etc. -- handle layout, etc.
-- @param tag The tag. -- @param _tag The tag.
-- @param prop The property name. -- @param prop The property name.
-- @param value The value. -- @param value The value.
function tag.setproperty(_tag, prop, value) function tag.setproperty(_tag, prop, value)

View File

@ -105,6 +105,7 @@ end
-- will be attached. -- will be attached.
-- @param wibox The wibox to attach. -- @param wibox The wibox to attach.
-- @param position The position of the wibox: top, bottom, left or right. -- @param position The position of the wibox: top, bottom, left or right.
-- @param screen TODO, this seems to be unused
function awfulwibox.attach(wibox, position, screen) function awfulwibox.attach(wibox, position, screen)
-- Store wibox as attached in a weak-valued table -- Store wibox as attached in a weak-valued table
local wibox_prop_table local wibox_prop_table
@ -202,7 +203,7 @@ function awfulwibox.stretch(wibox, screen)
end end
--- Create a new wibox and attach it to a screen edge. --- Create a new wibox and attach it to a screen edge.
-- @see capi.wibox -- @see wibox
-- @param args A table with standard arguments to wibox() creator. -- @param args A table with standard arguments to wibox() creator.
-- You can add also position key with value top, bottom, left or right. -- You can add also position key with value top, bottom, left or right.
-- You can also use width or height in % and set align to center, right or left. -- You can also use width or height in % and set align to center, right or left.

View File

@ -161,7 +161,7 @@ function graph.fit(_graph, width, height)
end end
--- Add a value to the graph --- Add a value to the graph
-- @param graph The graph. -- @param _graph The graph.
-- @param value The value between 0 and 1. -- @param value The value between 0 and 1.
-- @param group The stack color group index. -- @param group The stack color group index.
local function add_value(_graph, value, group) local function add_value(_graph, value, group)
@ -199,25 +199,24 @@ end
--- Set the graph height. --- Set the graph height.
-- @param graph The graph.
-- @param height The height to set. -- @param height The height to set.
function graph.set_height(_graph, height) function graph:set_height(height)
if height >= 5 then if height >= 5 then
data[_graph].height = height data[self].height = height
_graph:emit_signal("widget::updated") self:emit_signal("widget::updated")
end end
return _graph return self
end end
--- Set the graph width. --- Set the graph width.
-- @param graph The graph. -- @param graph The graph.
-- @param width The width to set. -- @param width The width to set.
function graph.set_width(_graph, width) function graph:set_width(width)
if width >= 5 then if width >= 5 then
data[_graph].width = width data[self].width = width
_graph:emit_signal("widget::updated") self:emit_signal("widget::updated")
end end
return _graph return self
end end
-- Build properties function -- Build properties function

View File

@ -158,32 +158,29 @@ function progressbar.fit(pbar, width, height)
end end
--- Set the progressbar value. --- Set the progressbar value.
-- @param pbar The progress bar.
-- @param value The progress bar value between 0 and 1. -- @param value The progress bar value between 0 and 1.
function progressbar.set_value(pbar, value) function progressbar:set_value(value)
local value = value or 0 local value = value or 0
local max_value = data[pbar].max_value local max_value = data[self].max_value
data[pbar].value = math.min(max_value, math.max(0, value)) data[self].value = math.min(max_value, math.max(0, value))
pbar:emit_signal("widget::updated") self:emit_signal("widget::updated")
return pbar return self
end end
--- Set the progressbar height. --- Set the progressbar height.
-- @param progressbar The progressbar.
-- @param height The height to set. -- @param height The height to set.
function progressbar.set_height(_progressbar, height) function progressbar:set_height(height)
data[_progressbar].height = height data[self].height = height
_progressbar:emit_signal("widget::updated") self:emit_signal("widget::updated")
return _progressbar return self
end end
--- Set the progressbar width. --- Set the progressbar width.
-- @param progressbar The progressbar.
-- @param width The width to set. -- @param width The width to set.
function progressbar.set_width(_progressbar, width) function progressbar:set_width(width)
data[_progressbar].width = width data[self].width = width
_progressbar:emit_signal("widget::updated") self:emit_signal("widget::updated")
return _progressbar return self
end end
-- Build properties function -- Build properties function

View File

@ -167,7 +167,7 @@ end
--- Filtering function to include all nonempty tags on the screen. --- Filtering function to include all nonempty tags on the screen.
-- @param t The tag. -- @param t The tag.
-- @param screen The screen we are drawing on. -- @param args unused list of extra arguments.
-- @return true if t is not empty, else false -- @return true if t is not empty, else false
function taglist.filter.noempty(t, args) function taglist.filter.noempty(t, args)
return #t:clients() > 0 or t.selected return #t:clients() > 0 or t.selected
@ -175,7 +175,7 @@ end
--- Filtering function to include all tags on the screen. --- Filtering function to include all tags on the screen.
-- @param t The tag. -- @param t The tag.
-- @param screen The screen we are drawing on. -- @param args unused list of extra arguments.
-- @return true -- @return true
function taglist.filter.all(t, args) function taglist.filter.all(t, args)
return true return true

View File

@ -23,7 +23,7 @@ end
-- @param obj The object to search in -- @param obj The object to search in
-- @param name The signal to find -- @param name The signal to find
-- @param error_msg Error message for if the signal is not found -- @param error_msg Error message for if the signal is not found
-- @returns The signal table -- @return The signal table
local function find_signal(obj, name, error_msg) local function find_signal(obj, name, error_msg)
check(obj) check(obj)
if not obj._signals[name] then if not obj._signals[name] then

View File

@ -53,7 +53,7 @@ end
--- Get the size of a cairo surface --- Get the size of a cairo surface
-- @param surf The surface you are interested in -- @param surf The surface you are interested in
-- @returns The surface's width and height -- @return The surface's width and height
local function surface_size(surf) local function surface_size(surf)
local cr = cairo.Context(surf) local cr = cairo.Context(surf)
local x, y, w, h = cr:clip_extents() local x, y, w, h = cr:clip_extents()

View File

@ -26,27 +26,24 @@ local cairo = require("lgi").cairo
local naughty = {} local naughty = {}
--- Naughty configuration - a table containing common popup settings. --- Naughty configuration - a table containing common popup settings.
-- @name config naughty.config = {}
-- @field padding Space between popups and edge of the workarea. Default: 4 --- Space between popups and edge of the workarea. Default: 4
-- @field spacing Spacing between popups. Default: 1 naughty.config.padding = 4
-- @field icon_dirs List of directories that will be checked by getIcon() --- Spacing between popups. Default: 1
naughty.config.spacing = 1
--- List of directories that will be checked by getIcon()
-- Default: { "/usr/share/pixmaps/", } -- Default: { "/usr/share/pixmaps/", }
-- @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" }
-- @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
-- Example: -- Example:
-- 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
-- @class table
naughty.config = {}
naughty.config.padding = 4
naughty.config.spacing = 1
naughty.config.icon_dirs = { "/usr/share/pixmaps/", }
naughty.config.icon_formats = { "png", "gif" }
naughty.config.notify_callback = nil naughty.config.notify_callback = nil
@ -55,12 +52,10 @@ naughty.config.notify_callback = nil
-- values (@see defaults) -- values (@see 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
-- @name config.presets
-- @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
-- @class table -- @class table
naughty.config.presets = { naughty.config.presets = {
normal = {}, normal = {},
low = { low = {
@ -75,8 +70,8 @@ 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 config.presets -- @see naughty.config.presets
-- @see notify -- @see naughty.notify
naughty.config.defaults = { naughty.config.defaults = {
timeout = 5, timeout = 5,
text = "", text = "",
@ -95,7 +90,6 @@ local urgency = {
} }
--- DBUS notification to preset mapping --- DBUS notification to preset mapping
-- @name config.mapping
-- The first element is an object containing the filter -- The first element is an object containing the filter
-- If the rules in the filter matches the associated preset will be applied -- If the rules in the filter matches the associated preset will be applied
-- The rules object can contain: urgency, category, appname -- The rules object can contain: urgency, category, appname

View File

@ -17,6 +17,7 @@ local fixed = {}
-- @param widgets The widgets to draw. -- @param widgets The widgets to draw.
-- @param fill_space Use all the available space, giving all that is left to the -- @param fill_space Use all the available space, giving all that is left to the
-- last widget -- last widget
-- @param wibox The wibox that this widget is drawn to.
-- @param cr The cairo context to use. -- @param cr The cairo context to use.
-- @param width The available width. -- @param width The available width.
-- @param height The available height. -- @param height The available height.

View File

@ -21,6 +21,7 @@ end
--- Draw a flex layout. Each widget gets an equal share of the available space --- Draw a flex layout. Each widget gets an equal share of the available space
-- @param dir "x" for a horizontal layout and "y" for vertical. -- @param dir "x" for a horizontal layout and "y" for vertical.
-- @param widgets The widgets to draw. -- @param widgets The widgets to draw.
-- @param wibox The wibox that this widget is drawn to.
-- @param cr The cairo context to use. -- @param cr The cairo context to use.
-- @param width The available width. -- @param width The available width.
-- @param height The available height. -- @param height The available height.