Module keygrabber

awesome keygrabber API

Functions

run (callback) Grab keyboard and read pressed keys, calling callback function at each key press, until keygrabber.stop is called.
stop () Stop grabbing the keyboard.
isrunning () Check if the keygrabber is running.


Functions

run (callback)
Grab keyboard and read pressed keys, calling callback function at each key press, until keygrabber.stop is called. 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.

Parameters:

  • callback: A callback function as described above.

Usage:

    Following function can be bound to a key, and 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 the keygrabber is running.

Returns:

    A boolean value, true if running, false otherwise.
generated by LDoc 1.2