Merge pull request #132 from awesomeWM/doc-fixes

A new set of doc fixes / improvements
This commit is contained in:
Daniel Hahler 2015-02-19 22:39:28 +01:00
commit 6bffd1938a
9 changed files with 58 additions and 42 deletions

View File

@ -5,3 +5,9 @@ description='highly configurable X window manager'
--format='markdown' or should it be discount? what is that anyway? how about plain? --format='markdown' or should it be discount? what is that anyway? how about plain?
dir='doc' dir='doc'
file={ 'lib/', '@SOURCE_DIR@/luadoc' } file={ 'lib/', '@SOURCE_DIR@/luadoc' }
-- Setup @client to be an alias for "@tparam client.client"
tparam_alias('client', 'client.client')
-- Should be default, but is not. Sets up "@tab" => "@tparam table".
tparam_alias('tab', 'table')

View File

@ -669,7 +669,7 @@ function client.floating.toggle(c)
end end
--- Remove the floating information on a client. --- Remove the floating information on a client.
-- @param c The client. -- @client c The client.
function client.floating.delete(c) function client.floating.delete(c)
client.floating.set(c, nil) client.floating.set(c, nil)
end end

View File

@ -106,8 +106,8 @@ local rules = {}
rules.rules = {} rules.rules = {}
--- Check if a client matches a rule. --- Check if a client matches a rule.
-- @param c The client. -- @client c The client.
-- @param rule The rule to check. -- @tab rule The rule to check.
-- @return True if it matches, false otherwise. -- @return True if it matches, false otherwise.
function rules.match(c, rule) function rules.match(c, rule)
if not rule then return false end if not rule then return false end
@ -128,8 +128,8 @@ function rules.match(c, rule)
end end
--- Check if a client matches any part of a rule. --- Check if a client matches any part of a rule.
-- @param c The client. -- @client c The client.
-- @param rule The rule to check. -- @tab 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
@ -148,10 +148,10 @@ function rules.match_any(c, rule)
end end
--- Get list of matching rules for a client. --- Get list of matching rules for a client.
-- @param c The client. -- @client c The client.
-- @param _rules The rules to check. List with "rule", "rule_any", "except" and -- @tab _rules The rules to check. List with "rule", "rule_any", "except" and
-- "except_any" keys. -- "except_any" keys.
-- @return The list of matched rules. -- @treturn table The list of matched rules.
function rules.matching_rules(c, _rules) function rules.matching_rules(c, _rules)
local result = {} local result = {}
for _, entry in ipairs(_rules) do for _, entry in ipairs(_rules) do
@ -164,17 +164,17 @@ function rules.matching_rules(c, _rules)
end end
--- Check if a client matches a given set of rules. --- Check if a client matches a given set of rules.
-- @param c The client. -- @client c The client.
-- @param rules The rules to check. List with "rule", "rule_any", "except" and -- @tab rules The rules to check. List with "rule", "rule_any", "except" and
-- "except_any" keys. -- "except_any" keys.
-- @return True if at least one rule is matched, false otherwise. -- @treturn boolean True if at least one rule is matched, false otherwise.
function rules.does_match(c, rules) function rules.does_match(c, rules)
local result = rules.matching_rules(c, rules) local result = rules.matching_rules(c, rules)
return #result == 0 and false or result return #result == 0 and false or result
end end
--- Apply awful.rules.rules to a client. --- Apply awful.rules.rules to a client.
-- @param c The client. -- @client c The client.
function rules.apply(c) function rules.apply(c)
local props = {} local props = {}
local callbacks = {} local callbacks = {}
@ -195,9 +195,9 @@ end
--- Apply properties and callbacks to a client. --- Apply properties and callbacks to a client.
-- @param c The client. -- @client c The client.
-- @param props Properties to apply. -- @tab props Properties to apply.
-- @param callbacks Callbacks to apply (optional). -- @tab callbacks Callbacks to apply (optional).
function rules.execute(c, props, callbacks) function rules.execute(c, props, callbacks)
for property, value in pairs(props) do for property, value in pairs(props) do
if property ~= "focus" and type(value) == "function" then if property ~= "focus" and type(value) == "function" then

View File

@ -43,7 +43,8 @@ function screen.getbycoord(x, y, default)
return default return default
end end
--- Give the focus to a screen, and move pointer. Keeps relative position of the pointer on the screen. --- Give the focus to a screen, and move pointer.
-- Keeps relative position of the pointer on the screen.
-- @param _screen Screen number. -- @param _screen Screen number.
function screen.focus(_screen) function screen.focus(_screen)
client = client or require("awful.client") client = client or require("awful.client")

View File

@ -1,3 +1,4 @@
--- Timer objects and functions.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- @author Uli Schlachter -- @author Uli Schlachter
-- @copyright 2014 Uli Schlachter -- @copyright 2014 Uli Schlachter
@ -18,12 +19,12 @@ local object = require("gears.object")
--- Timer objects. This type of object is useful when triggering events repeatedly. --- Timer objects. This type of object is useful when triggering events repeatedly.
-- The timer will emit the "timeout" signal every N seconds, N being the timeout -- The timer will emit the "timeout" signal every N seconds, N being the timeout
-- value. -- value.
-- @field timeout Interval in seconds to emit the timeout signal. Can be any -- @tfield number timeout Interval in seconds to emit the timeout signal.
-- value, including floating point ones (i.e. 1.5 seconds). -- Can be any value, including floating point ones
-- @field started Read-only boolean field indicating if the timer has been -- (e.g. 1.5 seconds).
-- started. -- @tfield boolean started Read-only boolean field indicating if the timer has been
-- @class table -- started.
-- @name timer -- @table timer
local timer = { mt = {} } local timer = { mt = {} }
@ -81,7 +82,11 @@ local timer_instance_mt = {
end end
} }
local function new(args) --- Create a new timer object.
-- @tparam table args Arguments.
-- @tparam number args.timeout Timeout in seconds (e.g. 1.5).
-- @treturn timer
timer.new = function(args)
local ret = object() local ret = object()
ret:add_signal("property::timeout") ret:add_signal("property::timeout")
@ -109,7 +114,7 @@ capi.awesome.connect_signal("refresh", function()
end) end)
--- Call the given function at the end of the current main loop iteration --- Call the given function at the end of the current main loop iteration
-- @param callback The function that should be called -- @tparam function callback The function that should be called
-- @param ... Arguments to the callback function -- @param ... Arguments to the callback function
function timer.delayed_call(callback, ...) function timer.delayed_call(callback, ...)
assert(type(callback) == "function", "callback must be a function, got: " .. type(callback)) assert(type(callback) == "function", "callback must be a function, got: " .. type(callback))
@ -117,7 +122,7 @@ function timer.delayed_call(callback, ...)
end end
function timer.mt:__call(...) function timer.mt:__call(...)
return new(...) return timer.new(...)
end end
return setmetatable(timer, timer.mt) return setmetatable(timer, timer.mt)

View File

@ -53,8 +53,10 @@ function textbox:fit(width, height)
return logical.width, logical.height return logical.width, logical.height
end end
--- Set a textbox' text. --- Set the text of the textbox (with Pango markup).
-- @param text The text to set. This can contain pango markup (e.g. <b>bold</b>) -- @param text The text to set. This can contain pango markup (e.g.
-- <pre><b>bold</b></pre>). You can use awful.util.escape to escape
-- parts of it.
function textbox:set_markup(text) function textbox:set_markup(text)
local attr, parsed = Pango.parse_markup(text, -1, 0) local attr, parsed = Pango.parse_markup(text, -1, 0)
-- In case of error, attr is false and parsed is an error message -- In case of error, attr is false and parsed is an error message

View File

@ -105,7 +105,7 @@ module("client")
-- @class function -- @class function
--- Swap a client with another one in global client list. --- Swap a client with another one in global client list.
-- @param c A client to swap with. -- @client A client to swap with.
-- @name swap -- @name swap
-- @class function -- @class function

View File

@ -5,17 +5,19 @@ module("mouse")
--- Mouse library. --- Mouse library.
-- @field screen Mouse screen number. -- @field screen Mouse screen number.
-- @class table -- @table mouse
-- @name mouse
--- A table with X and Y coordinates.
-- @field x X coordinate.
-- @field y Y coordinate.
-- @table coords_table
--- Get or set the mouse coords. --- Get or set the mouse coords.
-- @param coords_table None or a table with x and y keys as mouse coordinates. -- @tparam coords_table coords_table None or a table with x and y keys as mouse coordinates.
-- @param silent Disable mouse::enter or mouse::leave events that could be triggered by the pointer when moving. -- @tparam boolean silent Disable mouse::enter or mouse::leave events that could be triggered by the pointer when moving.
-- @return A table with mouse coordinates. -- @treturn coords_table A table with mouse coordinates.
-- @name coords -- @function coords
-- @class function
--- Get the client or any object which is under the pointer. --- Get the client or any object which is under the pointer.
-- @return A client or nil. -- @treturn client.client|nil A client or nil.
-- @name object_under_pointer -- @function object_under_pointer
-- @class function

View File

@ -11,8 +11,8 @@ module("root")
-- @class function -- @class function
--- Get or set global key bindings. --- Get or set global key bindings.
-- This binding will be available when you'll press keys on root window. -- These binding will be available when you press keys on the root window.
-- @param keys_array An array of key bindings objects, or nothing. -- @param keys_array An array of key binding objects, or nothing.
-- @return The array of key bindings objects of this client. -- @return The array of key bindings objects of this client.
-- @name keys -- @name keys
-- @class function -- @class function