# Module `awful.keygrabber`

Keygrabber Stack

### Info:

- Copyright: 2012 dodo
- Author: dodo

## Functions

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

## Functions

Methods

stop (g)
  Stop grabbing the keyboard for the provided callback. When no callback is given, the last grabber gets removed (last one added to the stack).
  - g The key grabber that must be removed.
run (g)
  Grab keyboard input and read pressed keys, calling the least callback function from the stack at each keypress, until the stack is empty.

  Calling run with the same callback again will bring the callback to the top of the stack.

  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

  A callback can return `false` to pass the events to the next keygrabber in the stack.

  - 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 be used to resize a
      -- client using the 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.6 Last updated 2017-01-20 01:17:18