Module keygrabber
awesome keygrabber API
Info:
- Copyright: 2008-2009 Julien Danjou
- Author: Julien Danjou <julien@danjou.info>
Functions
run (callback) | Grab keyboard input and read pressed keys, calling a callback function at each keypress, until keygrabber.stop is called. |
stop () | Stop grabbing the keyboard. |
isrunning () | Check if keygrabber is running. |
Functions
Methods- run (callback)
-
Grab keyboard input and read pressed keys, calling a callback function at
each keypress, until keygrabber.stop is called.
The callback function receives three arguments:
* a table containing modifiers keys * a string with the pressed key * a string with either "press" or "release" to indicate the event type.
- callback A callback function as described above.
Usage:
The following function can be bound to a key, and will be used to resize a client using keyboard. function resize(c) keygrabber.run(function(mod, key, event) if event == "release" then return end if key == 'Up' then awful.client.moveresize(0, 0, 0, 5, c) elseif key == 'Down' then awful.client.moveresize(0, 0, 0, -5, c) elseif key == 'Right' then awful.client.moveresize(0, 0, 5, 0, c) elseif key == 'Left' then awful.client.moveresize(0, 0, -5, 0, c) else keygrabber.stop() end end) end
- stop ()
- Stop grabbing the keyboard.
- isrunning ()
-
Check if keygrabber is running.
Returns:
-
bool
A boolean value, true if keygrabber is running, false otherwise.