manage signal handler: use awesome.startup
[awesome.git] / luadoc / keygrabber.lua
blob4e2e8bac9aedf3175b5972b429d0ae5ae05f0668
1 --- awesome keygrabber API
2 -- @author Julien Danjou <julien@danjou.info>
3 -- @copyright 2008-2009 Julien Danjou
4 module("keygrabber")
6 ---
7 -- Grab keyboard and read pressed keys, calling callback function at each key
8 -- press, until keygrabber.stop is called.
9 -- The callback function is passed three arguments:
10 -- a table containing modifiers keys, a string with the key pressed and a
11 -- string with either "press" or "release" to indicate the event type.
12 -- @param callback A callback function as described above.
13 -- @name run
14 -- @class function
15 -- @usage Following function can be bound to a key, and used to resize a client
16 -- using keyboard.
17 -- <p><code>
18 -- function resize(c) <br/>
19 -- keygrabber.run(function(mod, key, event) </br>
20 -- if event == "release" then return end </br></br>
22 -- if key == 'Up' then awful.client.moveresize(0, 0, 0, 5, c) <br/>
23 -- elseif key == 'Down' then awful.client.moveresize(0, 0, 0, -5, c) <br/>
24 -- elseif key == 'Right' then awful.client.moveresize(0, 0, 5, 0, c) <br/>
25 -- elseif key == 'Left' then awful.client.moveresize(0, 0, -5, 0, c) <br/>
26 -- else keygrabber.stop() <br/>
27 -- end <br/><br/>
29 -- end) <br/>
30 -- end <br/>
31 -- </code></p>
33 --- Stop grabbing the keyboard.
34 -- @name stop
35 -- @class function
37 --- Check if the keygrabber is running.
38 -- @return A boolean value, true if running, false otherwise.
39 -- @name isrunning
40 -- @class function