Module keygrabber

awesome keygrabber API

Info:

  • Copyright: 2008-2009 Julien Danjou
  • Author: Julien Danjou <[email protected]>

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 c:relative_move(0, 0, 0, 5)
            elseif key == 'Down' then c:relative_move(0, 0, 0, -5)
            elseif key == 'Right' then c:relative_move(0, 0, 5, 0)
            elseif key == 'Left'  then c:relative_move(0, 0, -5, 0)
            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.
generated by LDoc 1.4.6 Last updated 2017-07-25 16:21:08