awesome API documentation

# Module `awful.keygrabber`

### Info:

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

## 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.

## 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:

       The following function can be bound to a key, and used to resize a client
       using keyboard.

       function resize(c)
         local grabber = awful.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   awful.keygrabber.stop(grabber)
           end

         end)
       end

generated by LDoc 1.4.3 Last updated 2016-08-08 05:23:17