2009-08-20 16:18:52 +02:00
|
|
|
--- awesome keygrabber API
|
|
|
|
-- @author Julien Danjou <julien@danjou.info>
|
|
|
|
-- @copyright 2008-2009 Julien Danjou
|
|
|
|
module("keygrabber")
|
|
|
|
|
2012-02-21 15:55:55 +01:00
|
|
|
---
|
|
|
|
-- Grab keyboard and read pressed keys, calling callback function at each key
|
|
|
|
-- press, until keygrabber.stop is called.
|
|
|
|
-- The callback function is passed three arguments:
|
2009-08-20 16:18:52 +02:00
|
|
|
-- a table containing modifiers keys, a string with the key pressed and a
|
2009-08-30 06:20:52 +02:00
|
|
|
-- string with either "press" or "release" to indicate the event type.
|
2012-02-21 15:55:55 +01:00
|
|
|
-- @param callback A callback function as described above.
|
2009-08-20 16:18:52 +02:00
|
|
|
-- @name run
|
|
|
|
-- @class function
|
2011-01-16 18:44:59 +01:00
|
|
|
-- @usage Following function can be bound to a key, and used to resize a client
|
|
|
|
-- using keyboard.
|
|
|
|
-- <p><code>
|
|
|
|
-- function resize(c) <br/>
|
2012-02-21 15:55:55 +01:00
|
|
|
-- keygrabber.run(function(mod, key, event) </br>
|
|
|
|
-- if event == "release" then return end </br></br>
|
2011-01-16 18:44:59 +01:00
|
|
|
--
|
|
|
|
-- 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/>
|
|
|
|
--
|
2012-02-21 15:55:55 +01:00
|
|
|
-- end) <br/>
|
2011-01-16 18:44:59 +01:00
|
|
|
-- end <br/>
|
|
|
|
-- </code></p>
|
2009-08-20 16:18:52 +02:00
|
|
|
|
|
|
|
--- Stop grabbing the keyboard.
|
|
|
|
-- @name stop
|
|
|
|
-- @class function
|
2012-08-11 23:55:26 +02:00
|
|
|
|
|
|
|
--- Check if the keygrabber is running.
|
|
|
|
-- @return A boolean value, true if running, false otherwise.
|
|
|
|
-- @name isrunning
|
|
|
|
-- @class function
|