menubar: skip comments in .desktop files
[awesome.git] / luadoc / keygrabber.lua
blob278b82cf3795352d6a1f3d6eb939c8a0cd1c8ac8
1 --- awesome keygrabber API
2 -- @author Julien Danjou <julien@danjou.info>
3 -- @copyright 2008-2009 Julien Danjou
4 module("keygrabber")
6 ---
7 -- Grab keyboard input and read pressed keys, calling a callback function at
8 -- each keypress, until @{keygrabber.stop} is called.
9 --
10 -- The callback function receives three arguments:
11 -- <ul>
12 -- <li>a table containing modifiers keys</li>
13 -- <li>a string with the pressed key</li>
14 -- <li>a string with either "press" or "release" to indicate the event type.</li>
15 -- </ul>
16 -- @param callback A callback function as described above.
17 -- @name run
18 -- @class function
19 -- @usage
20 -- -- The following function can be bound to a key, and used to resize a client
21 -- -- using the keyboard.
22 -- function resize(c)
23 -- keygrabber.run(function(mod, key, event)
24 -- if event == "release" then return end
26 -- if key == 'Up' then awful.client.moveresize(0, 0, 0, 5, c)
27 -- elseif key == 'Down' then awful.client.moveresize(0, 0, 0, -5, c)
28 -- elseif key == 'Right' then awful.client.moveresize(0, 0, 5, 0, c)
29 -- elseif key == 'Left' then awful.client.moveresize(0, 0, -5, 0, c)
30 -- else keygrabber.stop()
31 -- end
32 -- end)
33 -- end
35 --- Stop grabbing the keyboard.
36 -- @name stop
37 -- @class function
39 --- Check if the keygrabber is running.
40 -- @return A boolean value, true if running, false otherwise.
41 -- @name isrunning
42 -- @class function