add usage example for keygrabber API

To demonstrate keygrabber API usage, I added a small function to the
docs that can be bound to a key and used to resize clients using
keyboard.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Anurag Priyam 2011-01-16 23:14:59 +05:30 committed by Uli Schlachter
parent 78a1788c6f
commit 1d42fd9697
1 changed files with 17 additions and 0 deletions

View File

@ -12,6 +12,23 @@ module("keygrabber")
-- @param func A callback function as described above. -- @param func A callback function as described above.
-- @name run -- @name run
-- @class function -- @class function
-- @usage Following function can be bound to a key, and used to resize a client
-- using keyboard.
-- <p><code>
-- function resize(c) <br/>
-- keygrabber.run(function(mod, key, event) </br>
-- if event == "release" then return true end </br><br/>
--
-- if key == 'Up' then awful.client.moveresize(0, 0, 0, 5, c) <br/>
-- elseif key == 'Down' then awful.client.moveresize(0, 0, 0, -5, c) <br/>
-- elseif key == 'Right' then awful.client.moveresize(0, 0, 5, 0, c) <br/>
-- elseif key == 'Left' then awful.client.moveresize(0, 0, -5, 0, c) <br/>
-- else keygrabber.stop() <br/>
-- end <br/><br/>
--
-- return true <br/>
-- end <br/>
-- </code></p>
--- Stop grabbing the keyboard. --- Stop grabbing the keyboard.
-- @param - -- @param -