# Module `awful.keygrabber`

### Info:

- Author: dodo
- Copyright: 2012 dodo
- Release: v3.5.1

## Functions

stop (g) | Stop grabbing the keyboard for the provided callback.
run (g) | Grab keyboard and read pressed keys, calling the least callback function from stack at each key press, until stack is empty.

## Tables

keygrabber | Keygrabber Stack awful.keygrabber

## Functions

stop (g)
  Stop grabbing the keyboard for the provided callback. When no callback is given, the least grabber gets removed (last one added to the stack).

  ### Parameters:

  - g The key grabber that must be removed.
run (g)
  Grab keyboard and read pressed keys, calling the least callback function from stack at each key press, until stack is empty. Calling run with the same callback again will bring the callback to the top of the stack. The callback function is passed three arguments: a table containing modifiers keys, a string with the key pressed and a string with either "press" or "release" to indicate the event type. A callback can return false to pass the events to the next key grabber in the stack.

  ### Parameters:

  - g The key grabber callback that will get the key events until it will be deleted or a new grabber is added.

  ### Returns:

  the given callback `g`

  ### Usage:

       Following function can be bound to a key, and used to resize a client
       using keyboard.
       <p><code>
       function resize(c) <br/>
         local grabber = awful.keygrabber.run(function(mod, key, event) </br>
           if event == "release" then return 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   awful.keygrabber.stop(grabber) <br/>
           end <br/><br/>

         end) <br/>
       end <br/>
       </code></p>

## Tables

keygrabber
  Keygrabber Stack awful.keygrabber

generated by LDoc 1.3