Merge pull request #265 from blueyed/doc-improve-key
doc: improve doc for key.key and awful.key
This commit is contained in:
commit
4bea4554fb
|
@ -6,33 +6,34 @@
|
||||||
|
|
||||||
--- Key object.
|
--- Key object.
|
||||||
--
|
--
|
||||||
-- @field key The key to press to triggers an event.
|
-- @tfield string key The key to trigger an event.
|
||||||
-- @field keysym Same as key, but return the name of the key symbol. It can
|
-- @tfield string keysym Same as key, but return the name of the key symbol. It
|
||||||
-- be identical to key, but for characters like '.' it will return 'period'.
|
-- can be identical to key, but for characters like '.' it will return
|
||||||
-- @field modifiers The modifier key that should be pressed while the key is
|
-- 'period'.
|
||||||
-- pressed. An array with all the modifiers. Valid modifiers are: Any, Mod1,
|
-- @tfield table modifiers The modifier key that should be pressed while the
|
||||||
-- Mod2, Mod3, Mod4, Mod5, Shift, Lock and Control.
|
-- key is pressed. An array with all the modifiers. Valid modifiers are: Any,
|
||||||
|
-- Mod1, Mod2, Mod3, Mod4, Mod5, Shift, Lock and Control.
|
||||||
-- @table key
|
-- @table key
|
||||||
|
|
||||||
--- Add a signal.
|
--- Add a signal.
|
||||||
--
|
--
|
||||||
-- @param name A signal name.
|
-- @tparam string name A signal name.
|
||||||
-- @param func A function to call when the signal is emitted.
|
-- @tparam function func A function to call when the signal is emitted.
|
||||||
-- @function connect_signal
|
-- @function connect_signal
|
||||||
|
|
||||||
--- Remove a signal.
|
--- Remove a signal.
|
||||||
--
|
--
|
||||||
-- @param name A signal name.
|
-- @tparam string name A signal name.
|
||||||
-- @param func A function to remove.
|
-- @tparam function func A function to remove.
|
||||||
-- @function disconnect_signal
|
-- @function disconnect_signal
|
||||||
|
|
||||||
--- Emit a signal.
|
--- Emit a signal.
|
||||||
--
|
--
|
||||||
-- @param name A signal name.
|
-- @tparam string name A signal name.
|
||||||
-- @param[opt] ... Various arguments.
|
-- @param[opt] ... Various arguments.
|
||||||
-- @function emit_signal
|
-- @function emit_signal
|
||||||
|
|
||||||
--- Get the number of instances.
|
--- Get the number of instances.
|
||||||
--
|
--
|
||||||
-- @return The number of key objects alive.
|
-- @treturn number The number of key objects alive.
|
||||||
-- @function instances
|
-- @function instances
|
||||||
|
|
|
@ -25,14 +25,19 @@ local ignore_modifiers = { "Lock", "Mod2" }
|
||||||
|
|
||||||
--- Create a new key to use as binding.
|
--- Create a new key to use as binding.
|
||||||
-- This function is useful to create several keys from one, because it will use
|
-- This function is useful to create several keys from one, because it will use
|
||||||
-- the ignore_modifier variable to create more key with or without the ignored
|
-- the ignore_modifier variable to create several keys with and without the
|
||||||
-- modifiers activated.
|
-- ignored modifiers activated.
|
||||||
-- For example if you want to ignore CapsLock in your keybinding (which is
|
-- For example if you want to ignore CapsLock in your keybinding (which is
|
||||||
-- ignored by default by this function), creating key binding with this function
|
-- ignored by default by this function), creating a key binding with this
|
||||||
-- will return 2 key objects: one with CapsLock on, and the other one with
|
-- function will return 2 key objects: one with CapsLock on, and another one
|
||||||
-- CapsLock off.
|
-- with CapsLock off.
|
||||||
-- @see key
|
-- @see key.key
|
||||||
-- @return A table with one or several key objects.
|
-- @tparam table mod A list of modifier keys. Valid modifiers are: Any, Mod1,
|
||||||
|
-- Mod2, Mod3, Mod4, Mod5, Shift, Lock and Control.
|
||||||
|
-- @tparam string _key The key to trigger an event.
|
||||||
|
-- @tparam function press Callback for when the key is pressed.
|
||||||
|
-- @tparam function release Callback for when the key is released.
|
||||||
|
-- @treturn table 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 = {}
|
||||||
local subsets = util.subsets(ignore_modifiers)
|
local subsets = util.subsets(ignore_modifiers)
|
||||||
|
|
Loading…
Reference in New Issue